#include <bits/stdc++.h>
using namespace std;
int n, a[4], b[4], ansmax, ansmin;
int main() {
  cin >> n;
  cin >> a[1] >> a[2] >> a[3];
  cin >> b[1] >> b[2] >> b[3];
  ansmax = min(a[1], b[2]) + min(a[2], b[3]) + min(a[3], b[1]);
  if (a[1] + b[2] > n) ansmin += a[1] + b[2] - n;
  if (a[2] + b[3] > n) ansmin += a[2] + b[3] - n;
  if (a[3] + b[1] > n) ansmin += a[3] + b[1] - n;
  printf("%d %d\n", ansmin, ansmax);
  return 0;
}
