#include<iostream>
#include<algorithm>

using namespace std;

int main(){
	int i, a[4], b[2], total = 0;
	for(i = 0; i < 4; i++) cin >> a[i];
	for(i = 0; i < 2; i++) cin >> b[i];
	sort(a, a + 4);
	for(i = 3; i >= 1; i--){
		total += a[i];
	}
	sort(b, b + 2);
	for(i = 1; i >= 1; i--){
		total += b[i];
	}
	cout << total << endl;
	return 0;
}