#include <bits/stdc++.h>
using namespace std;
#define ll unsigned long long

int main() {
    int a[6],i;
    for(i = 0;i < 6;i++){
        cin >> a[i];
    }
    sort(a,a + 4);
    cout << (a[5] > a[4] ? a[5] : a[4]) + a[3] + a[2] + a[1] << endl;

}
