#include using namespace std; #define REP(i,n) for(int i=0;i P; int main(void){ int i,j; cin.tie(0); ios_base::sync_with_stdio(false); int A1,A2,A3,B; cin >> A1 >> A2 >> A3 >> B; cout << max(3*A3,A1+A2+A3+B) << endl; return 0; }