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

int main(){
    int m, n;
    vector<int> a(4);
    for(int i = 0; i < 4; i++){
        cin >> a[i];
    }
    cin >> m >> n;
    sort(a.rbegin(), a.rend());
    int ans = a[0] + a[1] + a[2] + max(m,n);
    cout << ans << endl;
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=1000000007,MAX=1<<18,INF=1<<29;

int main(){
  int a,b,c,d,e,f;cin>>a>>b>>c>>d>>e>>f;
  cout<<a+b+c+d+e+f-min({a,b,c,d})-min(e,f)<<endl;
}

