using System; using System.Collections; using System.Collections.Generic; using System.Collections.Specialized; using System.Text; using System.Text.RegularExpressions; using System.Linq; class Magatro { static void Main() { string[] AB = Console.ReadLine().Split(' '); if (Compare(AB[0], AB[1])==1) { Console.WriteLine(AB[0]); } else { Console.WriteLine(AB[1]); } } static int Compare(string A,string B) { if (A.Length > B.Length) { return 1; } else if (A.Length < B.Length) { return -1; } for(int i = 0; i < A.Length; i++) { if (Com(A[i], B[i]) == 1) { return 1; } else if (Com(A[i], B[i]) == -1) { return -1; } } return 0; } static int Com(char a,char b) { if (a == '4' && b == '7') { return 1; } else if (a == '7' && b == '4') { return -1; } else { if (a > b) { return 1; } else if(a