module Yuki open System let solve a b = let swap4and7 = string >> fun x -> x.Replace('4', 't') >> fun x -> x.Replace('7', '4') >> fun x -> x.Replace('t', '7') >> int64 let a' = swap4and7 a let b' = swap4and7 b if a' > b' then a else b let A, B = let t = Console.ReadLine().Split() |> Array.map int64 t.[0], t.[1] solve A B |> Console.WriteLine