#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
const long long MAX = 1e6 + 5;
bool cmp(const pair<long long, long long> &a,
         const pair<long long, long long> &b) {
  if (a.first < b.first)
    return true;
  else if (a.first == b.first) {
    if (b.second > a.second) return true;
    return false;
  }
  return false;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long tc = 1, i, j;
  while (tc--) {
    long long n;
    cin >> n;
    long long a, b, c, d, e, f;
    cin >> a >> b >> c;
    cin >> d >> e >> f;
    long long mi, ma;
    mi = max(0LL, max(c - f - e, max(b - d - e, a - d - f)));
    ma = min(a, e) + min(b, f) + min(c, d);
    cout << mi << ' ' << ma << "\n";
  }
  return 0;
}
