import java.util.*; public class Osho{ public static void main(String... args){ Scanner scan = new Scanner(System.in); int x=scan.nextInt(),y=scan.nextInt(),x1=scan.nextInt(),y1=scan.nextInt(); System.out.println(count(x,y,x1,y1)); } public static int count(int x,int y,int x1,int y1){ int res = Math.max(x,y); if(x==y && x1==y1 && x1 < x){ res++; } return res; } }