function Main(input) {
  input = input.split("\n");
  var a = parseInt(input[0], 10);
  var b = parseInt(input[1], 10);
  var c = parseInt(input[2], 10);
  var d = parseInt(input[3], 10);

  var out = 0;

  if ( a < b ) {
    out += a;
  } else {
    out += b;
  }
  if ( c < d ) {
    out += c;
  } else {
    out += d;
  }

  console.log(out)
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
