#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
const int N = 1e6 + 7;
const int INF = 1e9 + 7;
const long long BIG_INF = 1e18;
const int T = (1 << 19);
template <class T>
inline T gcd(T a, T b) {
  while (b) swap(a %= b, b);
  return abs(a);
}
void solve() {
  int n;
  cin >> n;
  int a, b, c, d, e, first;
  cin >> a >> b >> c >> d >> e >> first;
  int maxi = min(a, e) + min(b, first) + min(c, d);
  int mini = max(0, a - d - first) + max(0, b - d - e) + max(0, c - e - first);
  cout << mini << ' ' << maxi << '\n';
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int t = 1;
  while (t--) {
    solve();
  }
}
