main(){char s[6];int a;gets(s);s[0]==63?a=s[2]==50?4:1:(a=s[2]==63?14:s[4]==63?a=s[2]==51?1:4:0);printf("%d",a);}