#include <bits/stdc++.h>
using namespace std;
long long x, r1, s1, p1, r2, s2, p2, r11, s11, p11, r22, s22, p22;
long long mxx() {
  long long R = min(r1, s2);
  long long S = min(s1, p2);
  long long P = min(p1, r2);
  return R + S + P;
}
void f1() {
  long long S = min(s11, r22);
  s11 -= S;
  r22 -= S;
}
void f2() {
  long long equal = min(r11, r22);
  r11 -= equal;
  r22 -= equal;
}
void f3() {
  long long P = min(p11, s22);
  p11 -= P;
  s22 -= P;
}
void f4() {
  long long equal = min(s11, s22);
  s11 -= equal;
  s22 -= equal;
}
void f5() {
  long long equal = min(p11, p22);
  p11 -= equal;
  p22 -= equal;
}
void f6() {
  long long P = min(r11, p22);
  r11 -= P;
  p22 -= P;
}
long long mn() {
  long long R = min(r11, s22);
  long long S = min(s11, p22);
  long long P = min(p11, r22);
  return R + S + P;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  cin >> x;
  cin >> r1 >> s1 >> p1 >> r2 >> s2 >> p2;
  long long mx = mxx();
  int a[6] = {1, 2, 3, 4, 5, 6};
  long long kl = 1e18;
  do {
    r11 = r1, s11 = s1, p11 = p1, r22 = r2, s22 = s2, p22 = p2;
    for (int i = 0; i < 6; i++) {
      if (a[i] == 1)
        f1();
      else if (a[i] == 2)
        f2();
      else if (a[i] == 3)
        f3();
      else if (a[i] == 4)
        f4();
      else if (a[i] == 5)
        f5();
      else
        f6();
    }
    kl = min(kl, mn());
  } while (next_permutation(a, a + 6));
  cout << kl << " " << mx << '\n';
  return 0;
}
