a,b,o,w=map(int,input().split()) cnt=o cnt+=max(a,b) cnt+=w print(cnt)