#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb emplace_back
typedef long long ll;
typedef pair<int,int> pint;

int s[7];
int main(){
    int sum=0;
    rep(i,6) cin>>s[i],sum+=s[i];
    sum-=*min_element(s,s+4)+min(s[4],s[5]);
    cout<<sum<<endl;
    return 0;
}
