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