#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const long long inf = 922337203685477;
const long long nax = 0;
long long n, mini = inf;
long long a[5], c[5];
vector<pair<long long, long long>> v;
long long b[3][2] = {{0, 2}, {1, 0}, {2, 1}};
void dfs(long long x) {
  if (x == 3) {
    for (long long i = 0; i < 3; i++) {
      c[i] = a[i];
    }
    vector<pair<long long, long long>> temp = v;
    for (long long i = 0; i < 3; i++) {
      long long idx = v[i].second;
      for (long long j = 0; j < 2; j++) {
        long long minis = min(v[i].first, a[b[idx][j]]);
        v[i].first -= minis;
        a[b[idx][j]] -= minis;
      }
    }
    long long ret = 0;
    for (long long i = 0; i < 3; i++) {
      long long idx = v[i].second;
      if (idx == 0) {
        ret += min(v[i].first, a[1]);
      } else if (idx == 1) {
        ret += min(v[i].first, a[2]);
      } else if (idx == 2) {
        ret += min(v[i].first, a[0]);
      }
    }
    mini = min(mini, ret);
    v = temp;
    for (long long i = 0; i < 3; i++) {
      a[i] = c[i];
    }
    return;
  } else {
    for (long long j = 0; j < 2; j++) {
      long long idx = v[x].second;
      long long minis = min(v[x].first, a[b[idx][j]]);
      v[x].first -= minis;
      a[b[idx][j]] -= minis;
      dfs(x + 1);
      v[x].first += minis;
      a[b[idx][j]] += minis;
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n;
  for (long long i = 0; i < 3; i++) {
    long long x;
    cin >> x;
    v.push_back({x, i});
  }
  for (long long i = 0; i < 3; i++) {
    cin >> a[i];
  }
  long long maxi =
      min(v[0].first, a[1]) + min(v[1].first, a[2]) + min(v[2].first, a[0]);
  sort(v.begin(), v.end());
  dfs(0);
  while (next_permutation(v.begin(), v.end())) {
    dfs(0);
  }
  cout << mini << " " << maxi << '\n';
}
