#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 10;
int main() {
  ios::sync_with_stdio(0);
  long long n, a1, a2, a3, b1, b2, b3;
  long long ans1, ans2;
  while (cin >> n) {
    cin >> a1 >> a2 >> a3 >> b1 >> b2 >> b3;
    ans1 = min(a1, b2) + min(a2, b3) + min(a3, b1);
    ans2 = max(max(a1 - b1 - b3, a2 - b2 - b1), a3 - b3 - b2);
    ans2 = max(ans2, (long long)0);
    cout << ans2 << " " << ans1 << endl;
  }
}
