#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  long long int n;
  cin >> n;
  long long int r1, s1, p1;
  cin >> r1 >> s1 >> p1;
  long long int r2, s2, p2;
  cin >> r2 >> s2 >> p2;
  long long int r1_s2 = min(r1, s2);
  long long int s1_p2 = min(s1, p2);
  long long int p1_r2 = min(p1, r2);
  long long int max_win = (r1_s2 + s1_p2 + p1_r2);
  long long int r2_mn = (r2 - r1 - s1);
  long long int s2_mn = (s2 - s1 - p1);
  long long int p2_mn = (p2 - p1 - r1);
  long long int mn_win = max(r2_mn, max(s2_mn, p2_mn));
  if (mn_win < 0) {
    mn_win = 0;
  }
  cout << mn_win << " " << max_win << '\n';
  return 0;
}
