open System open System.Collections.Generic [] let main argv = let [| a; b |] = Console.ReadLine().Split(' ') let result = if a.Length <> b.Length then if a.Length > b.Length then a else b else let rec mymax (x: string) (y: string) = if x.Length = 0 then "" else let s, ss = x.[0], x.Substring(1) let t, ts = y.[0], y.Substring(1) if (min s t = '4') && (max s t = '7') then "4" + mymax ss ts else if s <> t then if s > t then x else y else (string s) + mymax ss ts mymax a b printfn "%s" result //exit code 0