import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int x = scan.nextInt(); int y = scan.nextInt(); int x2 = scan.nextInt(); int y2 = scan.nextInt(); scan.close(); if(x == y && x2 == y2 && x2 < x) { int ans = x + 1; System.out.println(ans); }else { int ans = Math.max(x, y); System.out.println(ans); } } }