#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n;
  cin >> n;
  long long a[3], b[3];
  cin >> a[0] >> a[1] >> a[2];
  cin >> b[0] >> b[1] >> b[2];
  cout << max(0ll, a[0] - b[0] - b[2]) + max(0ll, a[1] - b[1] - b[0]) +
              max(0ll, a[2] - b[2] - b[1])
       << " ";
  cout << min(a[0], b[1]) + min(a[1], b[2]) + min(a[2], b[0]) << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  int t;
  t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
