#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  t = 1;
  while (t--) {
    long long int n;
    cin >> n;
    long long int r_a, r_b, s_a, s_b, p_a, p_b;
    cin >> r_a >> s_a >> p_a;
    cin >> r_b >> s_b >> p_b;
    long long int zero = 0;
    long long int max_win = min(r_a, s_b) + min(s_a, p_b) + min(p_a, r_b);
    long long int min_win = max(zero, (r_a - p_b - r_b)) +
                            max(zero, (-s_b - r_b + s_a)) +
                            max(zero, (-p_b - s_b + p_a));
    cout << min_win << " " << max_win << endl;
  }
}
