#include<stdio.h>
int main()
{
	int i,a,w1=0,w2=0,w3=0,k1=0,k2=0,k3=0;
	for(i=0;i<10;i++){
		scanf("%d",&a);
		if(w3<a){
			w3=a;
			if(w2<a){
				w3=w2;
				w2=a;
				if(w1<a){
					w2=w1;
					w1=a;
				}
			}
		}
	}
	for(i=0;i<10;i++){
		scanf("%d",&a);
		if(k3<a){
			k3=a;
			if(k2<a){
				k3=k2;
				k2=a;
				if(k1<a){
					k2=k1;
					k1=a;
				}
			}
		}
	}
	printf("%d %d\n",w1+w2+w3,k1+k2+k3);
	return 0;
}
#include <bits/stdc++.h>
using namespace std ;

#define pb(n) push_back(n)
#define fi first
#define se second
#define all(r) (r).begin(),(r).end()
#define gsort(st,en) sort((st),(en),greater<int>())
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
#define vary(type,name,size,init) vector< type> name(size,init)

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using dict = map<string,int>;
using pii = pair<int,int> ;
using pll = pair<ll,ll> ;

const int mod = 1000000007;
constexpr int imax = ((1<<30)-1)*2+1 ;
constexpr int inf = 100000000;
constexpr double PI = acos(-1.0) ;
double eps = 1e-10 ;
const int dy[] = {-1,0,1,0};
const int dx[] = {0,-1,0,1};

inline bool value(int x,int y,int w,int h){
  return (x >= 0 && x < w && y >= 0 && y < h);
}

template<typename T>
void Unique(vector<T> &v){
  sort(all(v));
  v.erase(unique(all(v)),v.end());
}

template<typename T>
T ston(string& str, T n){
  istringstream sin(str) ;
  T num ;
  sin >> num ;
  return num ;
}

void Ans(bool f){
  if(f) cout << "YES"<<endl;
  else cout << "NO"<<endl;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  vary(ll,w,10,0);
  vary(ll,k,10,0);
  rep(i,10){
    cin >> w[i];
  }
  sort(all(w));
  reverse(all(w));
  rep(i,10){
    cin >> k[i];
  }
  sort(all(k));
  reverse(all(k));
  ll a = 0, b = 0;
  rep(i,3){
    a += w[i];
  }
  rep(i,3){
    b += k[i];
  }
  cout << a << " " << b << endl;
  return 0;
}