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