#include using namespace std; typedef long long ll; typedef pair P; #define REP(i,n) for(int i=0;i> A >> B >> O >> W; int a=A+W,b=B+W,o=max(O+A+W,O+B+W),w=W; cout << max({a,b,o,w}) << endl; return 0; }