#include<iostream>
#include<algorithm>
using namespace std;
int main() {
	int ans = 0,sum=0;
	int a, b, c, d, e, f;
	cin >> a >> b >> c >> d >> e >> f;
	ans += max(e, f);
	sum += a + b + c + d;
	sum -= min(min(a, b), min(c, d));
	cout << sum + ans << endl;
}
