#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a, b, c, x, y, z;
  scanf("%d", &n);
  scanf("%d%d%d%d%d%d", &a, &b, &c, &x, &y, &z);
  printf("%d %d\n", max(0, max(a - x - z, max(b - x - y, c - z - y))),
         min(a, y) + min(b, z) + min(c, x));
  return 0;
}
