#include<iostream>
#include<algorithm>
#include<vector>
#define vi vector<int>
using namespace std;
int main(){vi v(4,0);vi v2(2,0);while(cin>>v[0]>>v[1]>>v[2]>>v[3]>>v2[0]>>v2[1]){sort(v.begin(),v.end());int ans=0;for(int i=1;i<=3;i++)ans+=v[4-i];cout<<ans+max(v2[0],v2[1])<<endl;}}