#world if 4>7 A,B=(list(i) for i in input().split()) if len(A)>len(B): Ou=A.join("") elif len(B)>len(A): Ou=B.join("") else: Ou=[] i=0 while iB[i]: if A[i]!=4: Ou=A if B[i]!=7: Ou=A elif B[i]>A[i]: if A[i]!=7: Ou=B if B[i]!=4: Ou=B i+=1 for i in range(len(Ou)): Ou[i]=str(Ou[i]) Ou=Ou.join("") print(Ou)