function Main(input) {
  input = input.split("\n");
  var A = input[0].split(" ");
  var B = input[1].split(" ");
  var sumA = 0, sumB = 0;
  for (var i = 0; i < 4; ++i) {
    sumA += parseInt(A[i]);
    sumB += parseInt(B[i]);
  }
  console.log("%d", Math.max(sumA, sumB));
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));