package me.yukicoder; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.InputStream; import java.io.PrintStream; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Scanner; import static java.util.stream.Collectors.joining; import static java.util.stream.Collectors.toList; public class YukiCoder293 { private static boolean LOCAL = System.getenv().keySet().stream().anyMatch(key -> key.startsWith("JAVA_MAIN_CLASS")); public static void run() { Scanner sc = new Scanner(System.in); String s = sc.nextLine(); String[] org = s.split(" "); String l = org[0]; String r = org[1]; s = s.replace('4', 'A'); s = s.replace('7', '4'); s = s.replace('A', '7'); String[] ss = s.split(" "); long a = Long.parseLong(ss[0]); long b = Long.parseLong(ss[1]); boolean left = false; if (a > b) { left = true; } System.out.println(left ? l : r); } private static TestCase getTest1() { return new TestCase("4", "4 7"); } private static TestCase getTest2() { return new TestCase("5", "5 7"); } private static TestCase getTest3() { return new TestCase("170", "40 170"); } private static TestCase getTest4() { return new TestCase("1234567890", "1237564890 1234567890"); } private static TestCase getTest5() { return new TestCase("", ""); } public static void main(String[] args) { perform(); } private static void perform() { if (LOCAL) { List tests = getTests(); boolean passed = true; int index = 1; for (TestCase testCase : getTests()) { String input = Arrays.stream(testCase.inputs).collect(joining(System.lineSeparator())); InputStream in = new ByteArrayInputStream(input.getBytes()); System.setIn(in); PrintStream sout = System.out; ByteArrayOutputStream baos = new ByteArrayOutputStream(); PrintStream ps = new PrintStream(baos); System.setOut(ps); try { run(); } finally { System.setOut(sout); } System.out.flush(); String actual = baos.toString().trim(); String expect = testCase.expect; boolean match = expect != null && expect.equals(actual); System.out.println("------------------------ " + index++ + "/" + tests.size() + " " + (match ? "PASS" : "FAIL")); System.out.println("INPUT: " + input); System.out.println("RESULT: " + match); System.out.println("EXPECTED: " + expect + ":"); System.out.println("ACTUAL: " + actual + ":"); if (!match) passed = false; } System.out.println("\n==== SUMMARY ==== "); System.out.println(passed ? "PASS" : "FAIL"); } else { run(); } } public static List getTests() { List testCases = new ArrayList<>(); testCases.add(getTest1()); testCases.add(getTest2()); testCases.add(getTest3()); testCases.add(getTest4()); testCases.add(getTest5()); return testCases.stream().filter(t -> !t.ignore()).collect(toList()); } private static class TestCase { String expect; String[] inputs; public TestCase(String expect, String[] inputs) { this.expect = expect; this.inputs = inputs; } public TestCase(String expect, String input) { this.expect = expect; this.inputs = new String[]{input}; } public boolean ignore() { return "".equals(expect) && inputs.length == 1 && "".equals(inputs[0]); } } }