print(max([input(),input()],key=lambda x:int(x.translate(x.maketrans('47','74')))))