#include <bits/stdc++.h>
const double PI = acos(-1);
#define rep(i, n) for (int i = 0; i < (int)(n); i++ )
using namespace std;
int findSumOfDigits(int n) {
  int sum = 0;
  while (n > 0) { // n が 0 になるまで
    sum += n % 10;
    n /= 10;
  }
  return sum;
}
int main(){
  int a, b, c, d, e, f;
  cin >> a >> b >> c >> d >> e >> f;
  vector<int> scinence = {a,b,c,d};
  vector<int> sorcial = {e,f};
  sort(scinence.begin(), scinence.end());
  int ans = 0;
  for(int i = 3; i > 0;--i) ans += scinence.at(i);
  ans += max(e,f);
  cout << ans << endl;
}

#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <limits>
typedef long long ll;
#define REP(i,n)   for(int i=0; i<(int)(n); ++i)
#define FOR(i,b,e) for(int i=(b); i<=(int)(e); ++i)

#define in cin
#define out cout
#define pb push_back
using namespace std;

int main(){
	int a[4], b[2], mi = 999, sum=0;
	REP(i, 4) {
		in >> a[i];
		sum += a[i];
		mi = min(mi, a[i]);
	}
	in >> b[0];
	in >> b[1];
	int bb = max(b[0], b[1]);
	sum -= mi;

	
	out << sum+bb << endl;
	return 0;

}