#include <bits/stdc++.h>
using namespace std;
long long n, a[4], b[4], maks, tmp, mins, f(1e18);
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 1; i <= 3; i++) {
    cin >> a[i];
  }
  for (int i = 1; i <= 3; i++) {
    cin >> b[i];
  }
  maks = min(a[1], b[2]) + min(a[2], b[3]) + min(a[3], b[1]);
  mins = max(b[3] - a[1] - a[3], max(b[2] - a[3] - a[2], b[1] - a[2] - a[1]));
  cout << max(mins, 0ll) << " " << maks << '\n';
}
