A, B = input().split() if len(A) != len(B): if len(A) > len(B): print(A) else: print(B) exit() compare = ["47", "74"] for i in range(len(A)): if A[i] + B[i] in compare: if A[i] == "4": print(A) exit() else: print(B) exit() else: if A[i] == B[i]: continue if int(A[i]) > int(B[i]): print(A) else: print(B) exit()