#include <bits/stdc++.h>
using namespace std;
void backtrack(int i, set<vector<int> >& ans, vector<int> cur) {
  if (i == 6) {
    ans.insert(cur);
    return;
  }
  int j, x;
  for (j = 1; j < (7); j++) {
    for (x = 0; x < (i); x++)
      if (cur[x] == j) break;
    if (x == i) {
      cur.push_back(j);
      backtrack(i + 1, ans, cur);
      cur.pop_back();
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  int q = 1, i, j, k;
  while (q--) {
    set<vector<int> > ans;
    vector<int> cur;
    backtrack(0, ans, cur);
    int n;
    cin >> n;
    int a[3], b[3];
    for (i = 0; i < (3); i++) cin >> a[i];
    for (i = 0; i < (3); i++) cin >> b[i];
    int win = 0, lose = INT_MAX;
    win = min(a[0], b[1]) + min(a[1], b[2]) + min(a[2], b[0]);
    for (auto it = ans.begin(); it != ans.end(); it++) {
      cur = *it;
      int ar = a[0], as = a[1], ap = a[2];
      int br = b[0], bs = b[1], bp = b[2];
      for (i = 0; i < (6); i++) {
        switch (cur[i]) {
          case 1:
            ar -= min(ar, br);
            br -= min(ar, br);
            break;
          case 2:
            ar -= min(ar, bp);
            bp -= min(ar, bp);
            break;
          case 3:
            as -= min(as, bs);
            bs -= min(as, bs);
            break;
          case 4:
            as -= min(as, br);
            br -= min(as, br);
            break;
          case 5:
            ap -= min(ap, bp);
            bp -= min(ap, bp);
            break;
          case 6:
            ap -= min(ap, bs);
            bs -= min(ap, bs);
            break;
        }
        lose = min(lose, ap + ar + as);
      }
    }
    cout << lose << " " << win;
  }
}
