function Main(input){
var inputs = input.split("\n");
var bus = inputs[0] <= inputs[1];
var train = inputs[2] <= inputs[3];
if(bus == true && train == true){
  console.log(new Number(inputs[0]) + new Number(inputs[2]));
}else if(bus != true && train == true){
  console.log(new Number(inputs[1]) + new Number(inputs[2]));
}else if(bus != true && train != true){
  console.log(new Number(inputs[1]) + new Number(inputs[3]));
}else{
  console.log(new Number(inputs[0]) + new Number(inputs[3]));
}
}
Main(require('fs').readFileSync('/dev/stdin','utf8'));