import java.util.Arrays; import java.util.LinkedList; import java.util.Scanner; public class Main { public static void main(String[] args){ Scanner sc = new Scanner(System.in); final long x = sc.nextLong(); final long y = sc.nextLong(); final long x2 = sc.nextLong(); final long y2 = sc.nextLong(); final long opt = x + y - Math.min(x, y); if(x == y && x2 == y2 && x2 < x && y2 < y){ System.out.println(opt + 3); }else if(x == 0 && x2 == 0 && y2 < y){ System.out.println(opt + 2); }else if(y == 0 && y2 == 0 && x2 < x){ System.out.println(opt + 2); }else { System.out.println(opt); } } }