function main(input) {
  const lines = input.split("\n").map((e) => Number(e))
  var min = Math.min(lines[0], lines[1])
  min += Math.min(lines[2], lines[3])
  console.log(min)
}


(() => {
  process.stdin.resume();
  process.stdin.setEncoding('utf8');
  var input_string = '';
  process.stdin.on('data', chunk => input_string += chunk);
  process.stdin.on('end', () => main(input_string));
})()
