#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll a, b, o, ab;
    cin >> a >> b >> o >> ab;
    cout << o + ab + max(a, b) << '\n';
}