#include <bits/stdc++.h>
using namespace std;
int a[6], b[6];
int getMinWin() {
  return max(a[0] - b[0] - b[2], 0) + max(a[1] - b[1] - b[0], 0) +
         max(a[2] - b[2] - b[1], 0);
}
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]);
  printf("%d %d\n", getMinWin(), getMaxWin());
}
