#include <iostream>
#include <algorithm>
using namespace std;

int main() {
	int a[4],b,c,d;
	cin >> a[0]>>a[1]>>a[2]>>a[3]>>b>>c;
	sort(a,a+4);
	reverse(a,a+4);
	if(b>c){
		d=b;
	}else{
		d=c;
	}
	cout << a[0]+a[1]+a[2]+d << endl;
	
	return 0;
}