#include <bits/stdc++.h>
using namespace std;
using namespace chrono;
void _print(long long t) { cerr << t; }
void _print(int t) { cerr << t; }
void _print(string t) { cerr << t; }
void _print(char t) { cerr << t; }
void _print(long double t) { cerr << t; }
void _print(double t) { cerr << t; }
void _print(unsigned long long t) { cerr << t; }
template <class T, class V>
void _print(T a[], V sz);
template <class T, class V>
void _print(pair<T, V> p);
template <class T>
void _print(vector<T> v);
template <class T>
void _print(set<T> v);
template <class T, class V>
void _print(map<T, V> v);
template <class T, class V>
void _print(unordered_map<T, V> v);
template <class T>
void _print(multiset<T> v);
template <class T, class V>
void _print(pair<T, V> p) {
  cerr << "{";
  _print(p.first);
  cerr << ",";
  _print(p.second);
  cerr << "}";
}
template <class T, class V>
void _print(T a[], V sz) {
  for (V i = 0; i < sz; i++) {
    _print(a[i]);
    cerr << " ";
  }
  cerr << endl;
}
template <class T>
void _print(vector<T> v) {
  cerr << "[ ";
  for (T i : v) {
    _print(i);
    cerr << " ";
  }
  cerr << "]";
  cerr << endl;
}
template <class T>
void _print(set<T> v) {
  cerr << "[ ";
  for (T i : v) {
    _print(i);
    cerr << " ";
  }
  cerr << "]";
  cerr << endl;
}
template <class T>
void _print(multiset<T> v) {
  cerr << "[ ";
  for (T i : v) {
    _print(i);
    cerr << " ";
  }
  cerr << "]";
}
template <class T, class V>
void _print(map<T, V> v) {
  cerr << "[ ";
  for (auto i : v) {
    _print(i);
    cerr << " ";
  }
  cerr << "]";
}
template <class T, class V>
void _print(unordered_map<T, V> v) {
  cerr << "[ ";
  for (auto i : v) {
    _print(i);
    cerr << " ";
  }
  cerr << "]";
}
long long mod = 1e18 + 1;
long long add(long long a, long long b) {
  return ((a % mod) + (b % mod)) % mod;
}
long long mul(long long a, long long b) {
  return ((a % mod) * (b % mod)) % mod;
}
long long sub(long long a, long long b) {
  return ((a % mod) - (b % mod) + mod) % mod;
}
long long max(long long a, long long b) { return (a > b) ? a : b; }
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long lcm(int a, int b) { return (a / gcd(a, b)) * b; }
long long fe(long long base, long long exp) {
  long long ans = 1;
  while (exp) {
    if (exp & 1) ans = mul(ans, base);
    base = mul(base, base);
    exp >>= 1;
  }
  return ans;
}
long long fact(long long n) {
  long long res = 1;
  for (int i = 1; i <= n; i++) {
    res = res * 1ll * i % mod;
  }
  return res;
}
long long modin(long long a) { return fe(a, mod - 2); }
long long nCr(long long a, long long b) {
  if (a < b) return 0;
  return mul(fact(a), mul(modin(fact(b)), modin(fact(a - b))));
}
void solve() {
  long long n;
  cin >> n;
  vector<long long> a(3), b(3);
  for (long long int i = 0; i < 3; i++) {
    cin >> a[i];
  }
  for (long long int i = 0; i < 3; i++) {
    cin >> b[i];
  }
  vector<pair<long long, long long>> p;
  for (long long int i = 0; i < 3; i++) {
    for (long long int j = 0; j < 3; j++) {
      if ((i == 0 && j == 1) || (i == 1 && j == 2) || (i == 2 && j == 0))
        continue;
      p.push_back({i, j});
    }
  }
  sort(p.begin(), p.end());
  long long minres = n,
            maxres = min(a[0], b[1]) + min(a[1], b[2]) + min(a[2], b[0]);
  do {
    vector<long long> a1 = a, b1 = b;
    for (long long int i = 0; i < p.size(); i++) {
      long long x = min(a1[p[i].first], b1[p[i].second]);
      a1[p[i].first] -= x;
      b1[p[i].second] -= x;
    }
    minres =
        min(minres, min(a1[0], b1[1]) + min(a1[1], b1[2]) + min(a1[2], b1[0]));
  } while (next_permutation(p.begin(), p.end()));
  cout << minres << " " << maxres << endl;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  int t = 1;
  while (t--) {
    solve();
  }
  cerr << "time taken : " << (float)clock() / CLOCKS_PER_SEC << " secs" << endl;
  return 0;
}
