#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> pll;
const ll mod=1e9+7;
//const ll mod=998244353;
const ll inf=5e18;

int main() {
  ll a,b,c,d;
  cin >> a >> b >> c >> d;
  cout << min(a,b)+min(c,d) << endl;
}
#include<iostream>
using namespace std;

int main(){
    int a,b,c,d,e,f,m,n;
    cin >> a >> b >> c >> d >> e >> f;
    
    if(a<b && a<c && a<d) m=b+c+d;
    if(b<a && b<c && b<d) m=a+c+d;
    if(c<a && c<b && c<d) m=a+b+d;
    if(d<a && d<b && d<c) m=a+b+c;
    if(e<f){
        n=f;
    }else{
        n=e;
    }
    cout << m+n << endl;
}
