import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String a = sc.next(); String b = sc.next(); String ans = ""; if(a.length() > b.length()) { ans = a; } else if(a.length() < b.length()) { ans = b; } else { for(int i = 0; i < a.length(); i++) { int num1 = Integer.parseInt(String.valueOf(a.charAt(i))); int num2 = Integer.parseInt(String.valueOf(b.charAt(i))); if(num1 > num2) { if(num1 == 7 && num2 == 4) { ans = b; } else { ans = a; } } else if(num1 < num2) { if(num1 == 4 && num2 == 7) { ans = a; } else { ans = b; } } } } System.out.println(ans); } }