#include <bits/stdc++.h>
using namespace std;
const int mod = 998244353;
const int base = 19260817;
const long long INF = 1e18;
const int maxn = 1e5 + 10;
const double eps = 1e-8;
inline int add(int x, int y) {
  x += y;
  return x >= mod ? x - mod : x;
}
inline int sub(int x, int y) {
  x -= y;
  return x < 0 ? x + mod : x;
}
inline int mul(int x, int y) { return 1LL * x * y % mod; }
int a[3], b[3], temp[3];
int calc(int r) {
  if (b[r] <= a[(r + 1) % 3])
    return max(0, a[(r + 2) % 3] - b[(r + 1) % 3]);
  else
    return max(0, a[(r + 2) % 3] - b[r] + a[(r + 1) % 3] - b[(r + 1) % 3]);
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  for (int i = 0; i < 3; i++) cin >> a[i];
  for (int i = 0; i < 3; i++) {
    cin >> b[i];
    temp[i] = b[i];
  }
  b[0] = temp[1], b[1] = temp[2], b[2] = temp[0];
  int mx = 0;
  for (int i = 0; i < 3; i++) mx += min(a[i], b[i]);
  for (int i = 0; i < 3; i++)
    if (a[i] + b[i] > n) {
      cout << a[i] + b[i] - n << " " << mx;
      return 0;
    }
  int mn = 1e9;
  for (int i = 0; i < 3; i++) mn = min(mn, calc(i));
  cout << mn << " " << mx;
  return 0;
}
