import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); StringBuilder sb = new StringBuilder(); int x = sc.nextInt(); int y = sc.nextInt(); int x1 = sc.nextInt(); int y1 = sc.nextInt(); int ans; if (x == y && x1 == y1 && x > x1) { ans = x + 1; } else { ans = Math.max(x, y); } System.out.println(ans); } }