import java.io.BufferedReader; import java.io.InputStreamReader; public class No208 { public static void main(String[] args) { try { BufferedReader br = new BufferedReader(new InputStreamReader( System.in)); int[] a = strToIntArray(br.readLine()); int x = a[0]; int y = a[1]; a = strToIntArray(br.readLine()); int x2 = a[0]; int y2 = a[1]; int min = Math.min(x, y); int sub = Math.abs(x - y); boolean isSameSide = x * x2 > 0 && y * y2 > 0; if (Math.abs(x2) - Math.abs(y2) != 0 && !isSameSide) { System.out.println(min + sub); } else { System.out.println(min + sub + 3); } } catch (Exception e) { System.err.println("Error:" + e.getMessage()); } } static int[] strToIntArray(String S) { String[] strArray = S.split(" "); int[] intArray = new int[strArray.length]; for (int i = 0; i < strArray.length; i++) { intArray[i] = Integer.parseInt(strArray[i]); } return intArray; } }