#include <bits/stdc++.h>
using namespace std;
int main() {
  long n;
  cin >> n;
  long ar, as, ap, br, bs, bp;
  cin >> ar >> as >> ap;
  cin >> br >> bs >> bp;
  long minWins = n - (min(br + bs, as) + min(bs + bp, ap) + min(bp + br, ar));
  long maxWins = min(ar, bs) + min(as, bp) + min(ap, br);
  cout << minWins << " " << maxWins << endl;
}
