import std.stdio;
import std.conv;
import std.string;
import std.array;

void main() {
  string[] input1 = split(readln());
  string[] input2 = split(readln());

  int S;
  int T;
  for(int i = 0; i < 4; ++i)
    S += to!int(input1[i]);

  for(int i = 0; i < 4; ++i)
    T += to!int(input2[i]);

  if (S > T)
    writeln(S);
  else
    writeln(T);
}

