C = input() def is_kadomatsu(A): return not A[0] < A[1] < A[2] and not A[0] > A[1] > A[2] ans = [] if is_kadomatsu(list(map(int, C.replace("?", "1").split()))): ans.append(1) if is_kadomatsu(list(map(int, C.replace("?", "4").split()))): ans.append(4) print(*ans, sep="")