#include <bits/stdc++.h>
using namespace std;

struct Fast {Fast(){std::cin.tie(0);ios::sync_with_stdio(false);}} fast;

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vector<int> > vii;
typedef queue<int> qi;
typedef stack<int> si;
typedef deque<int> dqi;

#define reps(i, a, b) for (int i = a; i < b; ++i)
#define rep(i, n) reps(i, 0, n)
#define REPS(i, a, b) reps(i, a, b)
#define REP(i, n) rep(i, n)
#define deps(i, a, b) for (int i = a; i >= b; --i)
#define dep(i, n) deps(i, n, 0)
#define DEPS(i, a, b) deps(i, a, b)
#define DEP(i, n) dep(i, n)

#define pf push_front
#define pb push_back
#define mp make_pair
#define fst first
#define FST fst
#define sec second
#define SEC sec
#define sz(obj) ((int)(obj).size())
#define all(v) (v).begin(), (v).end()
#define ALL(v) all(v)

const int INF = 999999999;
const int MOD = 1e9 + 7;
const int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};

inline bool inside(int y, int x, int H, int W) {return y >= 0 && x >= 0 && y < H && x < W;}
inline int in() {int x; std::cin >> x; return x;}
template <typename T>
void print(std::vector<T>& v, char c = ' ') {
  REP(i, v.size()) {
    if (i != 0) std::cout << c;
    std::cout << v[i];
  }
  std::cout << endl;
}
template <typename T> void print(T x) { std::cout << x << '\n'; }

signed main()
{
  vi v(4);

  rep(i, 4) v[i] = in();
  sort(all(v));
  print(v[1] + v[2] + v[3] + max(in(), in()));

  return (0);
}
#include<stdio.h>
#include<string.h>
int main(){
	int r=0,a[4],b[2],i,s=100,nf;
	scanf("%d%d%d%d%d%d",&a[0],&a[1],&a[2],&a[3],&b[0],&b[1]);
	for(i=0;i<4;i++){
		if(s>=a[i]){
			s=a[i];
			nf=i;
		}
	}
	for(i=0;i<4;i++){
		if(i!=nf){
			r+=a[i];
		}
	}
	if(b[0]>b[1]){
		r+=b[0];
	}else{
		r+=b[1];
	}

	printf("%d\n",r);
	return 0;
}