#include <bits/stdc++.h>
using namespace std;
long long int solve(long long int a1, long long int a2, long long int a3,
                    long long int b1, long long int b2, long long int b3,
                    long long int z) {
  bool vis[6];
  long long int temp = z;
  for (long long int i = 0; i < 6; i++) {
    if (temp % 2 == 0)
      vis[i] = false;
    else
      vis[i] = true;
    temp = temp / 2;
  }
  if (z == 127) return 0;
  long long int ans = 0, out = -1;
  for (long long int i = 0; i < 6; i++) {
    if (vis[i] == false) {
      long long int zz = pow(2, i);
      if (i == 0) {
        ans = min(a1, b1) +
              solve(a1 - min(a1, b1), a2, a3, b1 - min(a1, b1), b2, b3, z | zz);
        out = max(out, ans);
      }
      if (i == 1) {
        ans = min(a2, b2) +
              solve(a1, a2 - min(a2, b2), a3, b1, b2 - min(a2, b2), b3, z | zz);
        out = max(ans, out);
      }
      if (i == 2) {
        ans = min(a3, b3) +
              solve(a1, a2, a3 - min(a3, b3), b1, b2, b3 - min(a3, b3), z | zz);
        out = max(ans, out);
      }
      if (i == 3) {
        ans = min(a1, b3) +
              solve(a1 - min(a1, b3), a2, a3, b1, b2, b3 - min(a1, b3), z | zz);
        out = max(ans, out);
      }
      if (i == 4) {
        ans = min(a2, b1) +
              solve(a1, a2 - min(a2, b1), a3, b1 - min(a2, b1), b2, b3, z | zz);
        out = max(ans, out);
      }
      if (i == 5) {
        ans = min(a3, b2) +
              solve(a1, a2, a3 - min(a3, b2), b1, b2 - min(a3, b2), b3, z | zz);
        out = max(ans, out);
      }
    }
  }
  return out;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  long long int n;
  cin >> n;
  long long int a1, a2, a3, b1, b2, b3;
  cin >> a1 >> a2 >> a3;
  cin >> b1 >> b2 >> b3;
  long long int z = solve(a1, a2, a3, b1, b2, b3, 0), zz;
  z = n - z - 1;
  zz = min(a1, b2) + min(a2, b3) + min(a3, b1);
  cout << z << ' ' << zz << '\n';
}
