#include <bits/stdc++.h>
using namespace std;
inline int qr() {
  int f = 0, fu = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') fu = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    f = (f << 3) + (f << 1) + c - 48;
    c = getchar();
  }
  return f * fu;
}
int a[3], b[3];
int T;
int main() {
  T = qr();
  for (register int i = 0; i <= 2; ++i) a[i] = qr();
  for (register int i = 0; i <= 2; ++i) b[i] = qr();
  long long ans2 = 0, ans1 = max({0, a[0] - b[0] - b[2], a[1] - b[1] - b[0],
                                  a[2] - b[2] - b[1]});
  for (register int i = 0; i <= 2; ++i) ans2 += min(a[i], b[(i + 1) % 3]);
  printf("%lld %lld\n", ans1, ans2);
  return 0;
}
