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