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()); long x = a[0]; long y = a[1]; a = strToIntArray(br.readLine()); long x2 = a[0]; long y2 = a[1]; long min = Math.min(x, y); long 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 + 3); } else { System.out.println(min + sub); } } 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; } }