def kadomatu(c): center = c[1] if center == max(c): return True if center == min(c): return True return False c = input().split() ind = c.index('?') c1 = c.copy() c4 = c.copy() c1[ind] = 1 c4[ind] = 4 c1 = list(map(int, c1)) c4 = list(map(int, c4)) if kadomatu(c1): print(1, end="") if kadomatu(c4): print(4, end="")