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 ans = Math.max(x, y); if (x == y && x2 == y2) { ans += 1; } System.out.println(ans); } 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; } }