#include <bits/stdc++.h>
using namespace std;
void solve() {
  int i, j, sum = 0, prod = 1, maxl = 0, minl = 1e9;
  int n;
  cin >> n;
  vector<int> a(3), b(3);
  for (auto &x : a) cin >> x;
  for (auto &x : b) cin >> x;
  vector<pair<int, int>> v;
  maxl = min(a[0], b[1]) + min(a[1], b[2]) + min(a[2], b[0]);
  v.push_back(make_pair(0, 0));
  v.push_back(make_pair(0, 2));
  v.push_back(make_pair(1, 0));
  v.push_back(make_pair(1, 1));
  v.push_back(make_pair(2, 2));
  v.push_back(make_pair(2, 1));
  vector<int> p = {0, 1, 2, 3, 4, 5};
  vector<int> a_temp = a;
  vector<int> b_temp = b;
  do {
    int temp = 0;
    for (auto x : p) {
      int temp1 = min(a[v[x].first], b[v[x].second]);
      temp += temp1;
      a[v[x].first] -= temp1;
      b[v[x].second] -= temp1;
    }
    a = a_temp;
    b = b_temp;
    minl = min(minl, n - temp);
  } while (next_permutation(p.begin(), p.end()));
  cout << minl << ' ' << maxl << endl;
}
int32_t main() {
  int t = 1;
  while (t--) {
    solve();
  }
}
