#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n;
  cin >> n;
  vector<long long> alice(3), bob(3);
  for (long long i = 0; i < 3; ++i) {
    cin >> alice[i];
  }
  for (long long i = 0; i < 3; ++i) {
    cin >> bob[i];
  }
  long long mx = 0;
  for (long long i = 0; i < 3; ++i) {
    mx += min(alice[i], bob[(i + 1) % 3]);
  }
  long long mn = 0;
  for (long long i = 0; i < 3; ++i) {
    mn += min(alice[i], bob[i] + bob[(i + 2) % 3]);
  }
  cout << n - mn << " " << mx << '\n';
}
