#include<stdio.h>

int main(){
	int x,cj,cd,cs,min,max,minp,maxp;

	scanf("%d", &x);
	if(x<0 || x<100 || x>999){
		printf("-1\n");
		return 1;
	}

	cj = x%10;
	cd = (x/10)%10;
	cs = x/100;

	min = cj;
	minp = 1;
	if(cd<cj){
		min = cd;
		minp = 10;
	}
	if(cs<cd){
		min = cs;
		minp = 100;
	}

	max = cs;
	maxp = 100;
	if(cd>cs){
		max = cd;
		maxp = 10;
	}
	if(cj>cd){
		max = cj;
		maxp = 1;
	}

	if(max==0){
		printf("0\n");
	}


	return 0;
}
