a,b,o,w = map(int, input().split()) assert 1 <= a <= 1000, "NG" assert 1 <= b <= 1000, "NG" assert 1 <= o <= 1000, "NG" assert 1 <= w <= 1000, "NG" print(max(a+o+w, b+o+w))