import numpy as np c = input() c = c.replace(" ", "", 2) def is_kadomatsu(s): li = list(s) rank = np.argsort(li) if rank[0] == 1 or rank[2] == 1: return True else: return False c1 = c.replace("?", "1") c4 = c.replace("?", "4") ans = "" if is_kadomatsu(c1): ans += "1" if is_kadomatsu(c4): ans += "4" print(ans)