def km(s): l=s.split() a,b,c=sorted(l) if b==l[1]: return 0 return 1 s=input() for i in ("1","4"): if km(s.replace("?",i)): print(i,end="")