#include <iostream>
#include <algorithm>
#include <math.h>
using namespace std;


int main() {
	int A, B, C, D, E, F;
	cin >> A >> B >> C >> D >> E >> F;

	int X = min(A,B);
	int XX = min(C, D);
	int XXX = min(X, XX);

	int XXXX = max(E, F);

	cout << (A + B + C + D) - XXX + XXXX << endl;

	return 0;
}
