#include using namespace std; using ll = long long; void fast_io() { cin.tie(nullptr)->sync_with_stdio(false); } void solve() { int A[3], B; cin >> A[0] >> A[1] >> A[2] >> B; cout << max(3 * A[2], A[0] + A[1] + A[2] + B) << '\n'; } int main() { fast_io(); int t = 1; // cin >> t; while (t--) solve(); }