#include <bits/stdc++.h>
using namespace std;
const int M = 1e9 + 7;
const int N = 3e5 + 10;
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 ans1 = INT_MAX;
  vector<pair<int, int>> ord;
  ord.push_back({0, 0});
  ord.push_back({0, 2});
  ord.push_back({1, 1});
  ord.push_back({1, 0});
  ord.push_back({2, 2});
  ord.push_back({2, 1});
  do {
    vector<int> a1 = a, b1 = b;
    for (int i = 0; i < ord.size(); i++) {
      int cnt = min(a1[ord[i].first], b1[ord[i].second]);
      a1[ord[i].first] -= cnt;
      b1[ord[i].second] -= cnt;
    }
    int cur = min(a1[0], b1[1]) + min(a1[1], b1[2]) + min(a1[2], b1[0]);
    ans1 = min(ans1, cur);
  } while (next_permutation(ord.begin(), ord.end()));
  int ans2 = min(a[0], b[1]) + min(a[1], b[2]) + min(a[2], b[0]);
  cout << ans1 << ' ' << ans2;
  cout << "\n";
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
