import java.util.*; public class Exercise108{ public static void main (String[] args){ Scanner sc = new Scanner(System.in); int ox = sc.nextInt(); int oy = sc.nextInt(); int hx = sc.nextInt(); int hy = sc.nextInt(); if(ox == oy && hx == hy && ox > hx){ System.out.println(ox + 1); }else{ System.out.println(Math.max(ox, oy)); } } }