a, b = input().split() if len(a) != len(b): print(max([int(a), int(b)])) else: for i,j in zip(list(a),list(b)): if i == j: pass elif i == '4' and j == '7': print(a) break elif i == '7' and j == '4': print(b) break else: if i > j: print(a) break else: print(b) break