#include <bits/stdc++.h>
using namespace std;
int main() {
  int t = 1;
  while (t--) {
    int n;
    cin >> n;
    int a, b, c, d, e, f;
    cin >> a >> b >> c >> d >> e >> f;
    int Max = min(a, e) + min(b, f) + min(c, d);
    int Min = max(a - d - f, max(b - e - d, c - f - e));
    Min = max(Min, 0);
    cout << Min << " " << Max << endl;
  }
}
