#include<iostream>
#include<algorithm>
using namespace std;
int main(){
	int a,b,l=100,s=0;
	for(int i=0;i<4;i++){
		cin>>a;
		s+=a;
		l=min(a,l);
	}
	cin>>a>>b;
	cout<<s-l+max(a,b)<<endl;
	return 0;
}
#include <bits/stdc++.h>

using namespace std;

vector<int> SubjectsInfo;

int main() {
	int score;

	for (int i = 0; i < 6; ++i) {
		cin >> score;
		SubjectsInfo.push_back(score);
	}
	sort(SubjectsInfo.begin(), SubjectsInfo.begin() + 4);
	cout << SubjectsInfo[1] + SubjectsInfo[2] + SubjectsInfo[3] + max(SubjectsInfo[4], SubjectsInfo[5]) << endl;

	return 0;
}
