while 1:s=raw_input()+"="*99;x=n=0;exec"n+=1;x+=n*(ord(s[x])-61);"*20;print+(x>0)