#include <bits/stdc++.h>
using namespace std;
int a[6], b[6];
int getMinWin(int idx) {
  if (idx == 3) return a[0] + a[1] + a[2];
  int ret = INT_MAX;
  int bIdx = idx;
  int bIdxPrev = (idx - 1 + 3) % 3;
  int minIdxbIdx = min(a[idx], b[bIdx]);
  a[idx] -= minIdxbIdx;
  b[bIdx] -= minIdxbIdx;
  int minIdxbIdxPrev = min(a[idx], b[bIdxPrev]);
  a[idx] -= minIdxbIdxPrev;
  b[bIdxPrev] -= minIdxbIdxPrev;
  ret = min(ret, getMinWin(idx + 1));
  a[idx] += minIdxbIdx;
  b[bIdx] += minIdxbIdx;
  a[idx] += minIdxbIdxPrev;
  b[bIdxPrev] += minIdxbIdxPrev;
  return ret;
}
int getMaxWin() { return min(a[0], b[1]) + min(a[1], b[2]) + min(a[2], b[0]); }
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < 3; i++) scanf("%d", &a[i]);
  for (int i = 0; i < 3; i++) scanf("%d", &b[i]);
  int minWin = INT_MAX;
  for (int i = 0; i < 3; i++) {
    minWin = min(minWin, getMinWin(0));
    for (int j = 0; j < 2; j++) {
      swap(a[j], a[j + 1]);
      swap(b[j], b[j + 1]);
    }
  }
  printf("%d %d\n", minWin, getMaxWin());
}
