import java.util.*; // Yuki 208 // https://yukicoder.me/problems/no/208 public class Main { public static void main (String[] args) throws InterruptedException { Scanner in = new Scanner(System.in); long x = in.nextLong(); long y = in.nextLong(); long x1 = in.nextLong(); long y1 = in.nextLong(); long answer = Math.max(x, y); if (x == y && x1 == y1) { answer++; } System.out.println(answer); } }