import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner in=new Scanner(System.in);
String a=in.next();
StringBuilder b=new StringBuilder();
for (int i=0;i<110;i++){
b.append(i);
}
String c=b.toString();
Main kksk=new Main();
int ans=kksk.index(c,a);
System.out.println(ans);
}
private int index(String a,String b) {
int right=0,left=0;
for (int i=0;i<b.length();i++){
if (b.charAt(i)==a.charAt(right)){
right++;
if (right-left==b.length()){
return left;
}
}else {
left=right;
right++;
i=0;
}
}
return -1;
}
}