#include <bits/stdc++.h>
using namespace std;
auto clk = clock();
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const long long INF = 1e18L + 5;
const int d4i[4] = {-1, 0, 1, 0}, d4j[4] = {0, 1, 0, -1};
const int d8i[8] = {-1, -1, 0, 1, 1, 1, 0, -1},
          d8j[8] = {0, 1, 1, 1, 0, -1, -1, -1};
void solve() {
  long long n;
  cin >> n;
  vector<long long> a(3), b(3);
  for (long long i = 0, _n = (3); i < _n; i++) {
    cin >> a[i];
  }
  for (long long i = 0, _n = (3); i < _n; i++) {
    cin >> b[i];
  }
  long long mn = max(0ll, max(a[0] - b[2] - b[0],
                              max(a[1] - b[0] - b[1], a[2] - b[1] - b[2])));
  long long mx = min(a[0], b[1]) + min(a[1], b[2]) + min(a[2], b[0]);
  cout << mn << " " << mx;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout << setprecision(11);
  long long t = 1;
  while (t--) solve();
  return 0;
}
