i = input() a = list(map(int, i.replace("?", "1").split())) b = list(map(int, i.replace("?", "4").split())) if a[1]==min(a) or a[1]==max(a): print(1, end="") if b[1]==min(b) or b[1]==max(b): print(4, end="")