#include <bits/stdc++.h>
const long double pi = acos(-1.0);
const long double eps = 1e-9;
using namespace std;
void solve() {
  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];
  int mx = min(a[0], b[1]) + min(a[1], b[2]) + min(a[2], b[0]);
  vector<pair<int, int>> id;
  vector<int> p(9);
  iota(p.begin(), p.end(), 1);
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) {
      id.push_back({i, j});
    }
  }
  int mn = 1e9;
  do {
    int res = 0;
    vector<int> cnt_a, cnt_b;
    cnt_a = a, cnt_b = b;
    for (int j = 0; j < p.size(); j++) {
      int i = p[j];
      if ((id[i].first + 1) % 3 == id[i].second)
        res += min(cnt_a[id[i].first], cnt_b[id[i].second]);
      int m = min(cnt_a[id[i].first], cnt_b[id[i].second]);
      cnt_a[id[i].first] -= m;
      cnt_b[id[i].second] -= m;
    }
    mn = min(mn, res);
  } while (next_permutation(p.begin(), p.end()));
  cout << mn << " " << mx << endl;
}
int main() {
  ios::sync_with_stdio(NULL), cin.tie(0), cout.tie(0);
  cout.setf(ios::fixed), cout.precision(10);
  int step;
  step = 1;
  for (int i = 1; i <= step; i++) {
    solve();
  }
}
