#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a[3], b[3];
  cin >> n;
  cin >> a[0] >> a[1] >> a[2];
  cin >> b[0] >> b[1] >> b[2];
  vector<int> D;
  for (int i = 0; i < 6; i++) D.push_back(i);
  int Dmax = min(a[0], b[1]) + min(a[1], b[2]) + min(a[2], b[0]);
  int Dmin = INT_MAX;
  vector<pair<int, int>> T;
  T.push_back(make_pair(0, 0));
  T.push_back(make_pair(0, 2));
  T.push_back(make_pair(1, 1));
  T.push_back(make_pair(1, 0));
  T.push_back(make_pair(2, 2));
  T.push_back(make_pair(2, 1));
  do {
    int A[3], B[3], cnt = 0;
    for (int i = 0; i < 3; i++) A[i] = a[i], B[i] = b[i];
    for (auto i : D) {
      cnt += min(A[T[i].first], B[T[i].second]);
      A[T[i].first] -= min(A[T[i].first], B[T[i].second]);
      B[T[i].second] -= min(A[T[i].first], B[T[i].second]);
    }
    Dmin = min(Dmin, n - cnt);
  } while (next_permutation(D.begin(), D.end()));
  cout << Dmin << " " << Dmax;
  return 0;
}
