#include<bits/stdc++.h>

using namespace std;

int main(){

  vector<int> rika(4);
  vector<int> syakai(2);
  int sum=0;
  
  for(int i=0;i<4;++i)
	cin>>rika[i];

  for(int i=0;i<2;++i)
	cin>>syakai[i];

  sort(rika.begin(),rika.end());
  sort(syakai.begin(),syakai.end());

  for(int i=3;i>=1;--i)
	sum+=rika[i];

  sum+=syakai[1];

  cout<<sum<<endl;
  
}

