a, b = input().split() if len(a) > len(b): print(a) elif len(a) < len(b): print(b) else: for i in range(len(a)): if a[i] != b[i]: if a[i] == "4" and b[i] == "7": print(a) break elif a[i] == "7" and b[i] == "4": print(b) break else: a = int(a) b = int(b) if a > b: print(a) break else: print(b) break