#include using namespace std; using ll = long long; int main(){ ll a,b,a1,b1; cin >> a >> b >> a1 >> b1; if(a1 != 0 && b1!= 0){ cout << a + b << endl; }else{ if(a1 == 0) cout << b + 2 << endl; else if(b1 == 0) cout << a + 2 << endl; } return 0; }