#include <bits/stdc++.h>
int exp(int x, int y, int p) {
  int res = 1;
  while (y) {
    if (y % 2) res = (res * x % p) % p;
    x = (x * x) % p;
    y /= 2;
  }
  return res;
}
int expo(int x, int y) {
  int res = 1;
  while (y) {
    if (y % 2) res = (res * x % ((int)1e9 + 7)) % ((int)1e9 + 7);
    x = (x * x) % ((int)1e9 + 7);
    y /= 2;
  }
  return res;
}
long long add(long long a, long long b) {
  return (a % ((int)1e9 + 7) + b % ((int)1e9 + 7) + ((int)1e9 + 7)) %
         ((int)1e9 + 7);
}
int sub(int a, int b) {
  return (a % ((int)1e9 + 7) - b % ((int)1e9 + 7) + ((int)1e9 + 7)) %
         ((int)1e9 + 7);
}
long long mul(long long a, long long b) {
  return ((a % ((int)1e9 + 7)) * (b % ((int)1e9 + 7)) + ((int)1e9 + 7)) %
         ((int)1e9 + 7);
}
int inv(int x) { return expo(x, ((int)1e9 + 7) - 2); }
int sv[2000006] = {0};
void sve() {
  sv[0] = 1;
  sv[1] = 1;
  for (int i = 2; i * i < 100005; i++) {
    if (!sv[i]) {
      for (int j = i * i; j < 100005; j += i) sv[j] = 1;
    }
  }
}
using namespace std;
int main() {
  long long n;
  cin >> n;
  vector<long long> v1(4), v2(4);
  for (int i = 1; i <= 3; i++) cin >> v1[i];
  for (int i = 1; i <= 3; i++) cin >> v2[i];
  vector<pair<long long, long long>> perm;
  perm.push_back({1, 1});
  perm.push_back({2, 2});
  perm.push_back({3, 3});
  perm.push_back({1, 3});
  perm.push_back({2, 1});
  perm.push_back({3, 2});
  long long g_min = 10000000000;
  do {
    vector<long long> t1 = v1, t2 = v2;
    for (auto v : perm) {
      long long sub = min(t1[v.first], t2[v.second]);
      t1[v.first] -= sub;
      t2[v.second] -= sub;
    }
    long long ans = 0;
    for (int i = 1; i <= 3; i++) {
      ans += t1[i];
    }
    g_min = min(g_min, ans);
  } while (next_permutation(perm.begin(), perm.end()));
  long long g_max = min(v1[1], v2[2]) + min(v1[2], v2[3]) + min(v1[3], v2[1]);
  cout << g_min << " " << g_max << "\n";
}
