print(max(*map(int,input().split()),key=lambda x:int(x.translate(x.maketrans('47','74')))))