#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> a(3), b(3);
  for (int i = 0; i < 3; i++) cin >> a[i];
  for (int i = 0; i < 3; i++) cin >> b[i];
  vector<pair<int, int>> ord = {{0, 2}, {1, 0}, {2, 1}, {0, 0}, {1, 1}, {2, 2}};
  sort(ord.begin(), ord.end());
  int mx = min(a[0], b[1]) + min(a[1], b[2]) + min(a[2], b[0]);
  int mn = INT_MAX;
  do {
    vector<int> a1 = a, b1 = b;
    for (int i = 0; i < (int)ord.size(); i++) {
      int cur = min(a1[ord[i].first], b1[ord[i].second]);
      a1[ord[i].first] -= cur;
      b1[ord[i].second] -= cur;
    }
    int cur = min(a1[0], b1[1]) + min(a1[1], b1[2]) + min(a1[2], b1[0]);
    mn = min(mn, cur);
  } while (next_permutation(ord.begin(), ord.end()));
  cout << mn << " " << mx << endl;
}
