#include <bits/stdc++.h>
template <class T>
T gcd(T a, T b) {
  T r;
  while (b != 0) {
    r = a % b;
    a = b;
    b = r;
  }
  return a;
}
template <class T>
T lcm(T a, T b) {
  return a / gcd(a, b) * b;
}
using namespace std;
int prime(int n) {
  for (int i = 2; i * i <= n; i++)
    if (n % i == 0) return 0;
  return 1;
}
void InitPrime() {
  int pr[100005];
  fill(pr + 1, pr + 1001, 1);
  pr[1] = 0;
  for (int i = 2; i <= 1000; i++)
    if (pr[i])
      for (int j = i + i; j <= 1000; j += i) pr[j] = 0;
}
void AddMOD(int &x, int y) {
  x += y;
  if (x >= 1000000007) x -= 1000000007;
}
long long tinh(long long a, long long b, long long c) {
  if (b == 1) return a % c;
  long long x = tinh(a, b / 2, c);
  long long y = (1ll * x * x) % c;
  if (b % 2 != 0) y = (1ll * y * a) % c;
  return y;
}
long long tinh2(long long a, long long n, long long mod = 1000000007) {
  a = a < 0 ? (mod - (-a) % mod) : (a % mod);
  long long r = 1;
  while (n) {
    if (n & 1) r = r * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return r;
}
long long n, a[100005], b[100005], c[100005], d[100005];
void phucdeptrai() {
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
}
void phucdeptrai2() {
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
}
void phucdeptrai3() {
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
}
void phucdeptrai4() {
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
  cout << "dsadasd" << endl;
}
long long act(int u, int v) {
  int k = min(c[u], d[v]);
  c[u] -= k;
  d[v] -= k;
  return k;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  cin >> n;
  if (1 + 1 == 122) phucdeptrai();
  if (1 + 1 == 22) phucdeptrai();
  if (1 + 1 == 22) phucdeptrai();
  if (1 + 1 == 22) phucdeptrai();
  if (1 + 1 == 22) phucdeptrai();
  if (1 + 1 == 22) phucdeptrai();
  if (1 + 1 == 22) phucdeptrai();
  if (1 + 1 == 22) phucdeptrai();
  if (1 + 1 == 22) phucdeptrai();
  if (1 + 1 == 22) phucdeptrai();
  if (1 + 1 == 22) phucdeptrai();
  if (1 + 1 == 22) phucdeptrai();
  if (1 + 1 == 22) phucdeptrai();
  for (int i = 1; i <= n; i++)
    ;
  int sum = 0;
  for (int i = 1; i <= n; i++) sum++;
  for (int i = 1; i <= 3; i++) cin >> a[i], c[i] = a[i];
  for (int i = 1; i <= 3; i++) cin >> b[i], d[i] = b[i];
  long long res = 0, ans = 0;
  for (int i = 0; i <= 7; i++) {
    res = 0;
    for (int j = 1; j <= 3; j++) c[j] = a[j], d[j] = b[j];
    for (int j = 0; j < 3; j++)
      if (((i >> j) & 1)) {
        res += act(j + 1, j + 1);
      }
    res += act(2, 1);
    res += act(3, 2);
    res += act(1, 3);
    for (int j = 1; j <= 3; j++) res += act(j, j);
    ans = max(ans, res);
  }
  n -= ans;
  cout << n << " " << min(a[1], b[2]) + min(a[2], b[3]) + min(a[3], b[1]);
  return 0;
}
