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