import java.util.*; import java.math.*; import java.text.*; public class Main { private static Scanner sc = new Scanner(System.in); public static void main(String[] args) throws Exception { int x = sc.nextInt(); int y = sc.nextInt(); int x1 = sc.nextInt(); int y1 = sc.nextInt(); if (x > y) { System.out.println(x); } else if (y > x) { System.out.println(y); } else { if (x1 == y1 && x1 < x) { System.out.println(x+1); } else { System.out.println(x); } } } }