import java.util.Scanner; public class Ousho { public static void main(String[] args) { Scanner s = new Scanner(System.in); int x = s.nextInt(),y = s.nextInt(),x2 = s.nextInt(),y2 = s.nextInt(); s.close(); int count = 0; if(x == y){ if(x2 == y2 && x > x2){ count = x+1; }else{ count = x; } }else{ count = Math.min(x, y) + Math.abs(x-y); } System.out.println(count); } }