import std.stdio,
       std.string,
       std.conv,
       std.algorithm;

void main() {
  int[] a;
  for (int i = 0; i < 4; i++) {
    a ~= readln.chomp.to!(int);
  }

  writeln(min(a[0], a[1]) + min(a[2], a[3]));
}
