#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n;
  cin >> n;
  long long a, b, c;
  cin >> a >> b >> c;
  long long x, y, z;
  cin >> x >> y >> z;
  long long ans1 = max({0LL, a - x - z, b - y - x, c - y - z});
  long long ans2 = min(a, y) + min(b, z) + min(c, x);
  cout << ans1 << " " << ans2 << '\n';
  return 0;
}
