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