#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using pll = pair<ll, ll>;
const ll MOD = 1e9 + 9;
int main(int argc, char** argv) {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ll n;
  cin >> n;
  ll ansMin = 4557430888798830399ll, ansMax = 0;
  vector<long long> a(3), b(3);
  for (int i = 0, _n = (3); i < _n; i++) cin >> a[i];
  for (int i = 0, _n = (3); i < _n; i++) cin >> b[i];
  vector<pll> orders;
  orders.push_back({0, 0});
  orders.push_back({0, 2});
  orders.push_back({1, 1});
  orders.push_back({1, 0});
  orders.push_back({2, 1});
  orders.push_back({2, 2});
  sort((orders).begin(), (orders).end());
  do {
    vector<long long> a1, b1;
    a1 = a;
    b1 = b;
    for (auto& match : orders) {
      ll temp = min(a1[match.first], b1[match.second]);
      a1[match.first] -= temp;
      b1[match.second] -= temp;
    }
    ll currWins = min(a1[0], b1[1]) + min(a1[2], b1[0]) + min(a1[1], b1[2]);
    ansMin = min(ansMin, currWins);
  } while (next_permutation((orders).begin(), (orders).end()));
  ansMax = min(a[0], b[1]) + min(a[2], b[0]) + min(a[1], b[2]);
  cout << ansMin << " " << ansMax << '\n';
  return 0;
}
