#include <bits/stdc++.h>
using namespace std;
using namespace std;
long long fpow(long long x, long long y, long long p = 1000000007) {
  x = x % p;
  long long sum = 1;
  while (y) {
    if (y & 1) sum = sum * x;
    sum %= p;
    y = y >> 1;
    x = x * x;
    x %= p;
  }
  return sum;
}
long long inv(long long a, long long m = 1000000007) {
  long long c = m;
  long long y = 0, x = 1;
  if (m == 1) return 0;
  while (a > 1) {
    long long q = a / m;
    long long t = m;
    m = a % m, a = t;
    t = y;
    y = x - q * y;
    x = t;
  }
  if (x < 0) x += c;
  return x;
}
long long add(long long a, long long b) {
  if (a < 0) a += 1000000007;
  if (b < 0) b += 1000000007;
  return (a % 1000000007 + b % 1000000007 + 1000000007) % 1000000007;
}
long long sub(long long a, long long b) {
  if (a < 0) a += 1000000007;
  if (b < 0) b += 1000000007;
  return (a % 1000000007 - b % 1000000007 + 1000000007) % 1000000007;
}
long long mul(long long a, long long b) {
  if (a < 0) a += 1000000007;
  if (b < 0) b += 1000000007;
  return ((a % 1000000007) * (b % 1000000007) + 1000000007) % 1000000007;
}
void setIO(string name = "") {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  if ((int)(name).size()) {
    freopen((name + ".in").c_str(), "r", stdin);
    freopen((name + ".out").c_str(), "w", stdout);
  }
}
int main() {
  setIO();
  long long n;
  cin >> n;
  vector<long long> a(3), b(3);
  for (int i = 0; i < 3; i++) cin >> a[i];
  for (int i = 0; i < 3; i++) cin >> b[i];
  long long maxwins = min(a[0], b[1]) + min(a[1], b[2]) + min(a[2], b[0]);
  long long minwins = LLONG_MAX;
  vector<pair<long long, long long> > comb;
  comb.push_back({0, 0});
  comb.push_back({1, 1});
  comb.push_back({2, 2});
  comb.push_back({0, 2});
  comb.push_back({1, 0});
  comb.push_back({2, 1});
  sort(comb.begin(), comb.end());
  do {
    vector<long long> tmpa = a;
    vector<long long> tmpb = b;
    long long score = 0;
    for (int i = 0; i < comb.size(); i++) {
      long long z = min(tmpa[comb[i].first], tmpb[comb[i].second]);
      tmpa[comb[i].first] -= z;
      tmpb[comb[i].second] -= z;
    }
    score =
        min(tmpa[0], tmpb[1]) + min(tmpa[1], tmpb[2]) + min(tmpa[2], tmpb[0]);
    minwins = min(minwins, score);
  } while (next_permutation(comb.begin(), comb.end()));
  cout << minwins << " " << maxwins << "\n";
}
