#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  long long int r1, s1, p1, r2, s2, p2;
  cin >> r1 >> s1 >> p1;
  cin >> r2 >> s2 >> p2;
  long long int mx = 0;
  long long int mn = 0;
  long long int x = 0;
  mx += min(r1, s2);
  mx += min(s1, p2);
  mx += min(p1, r2);
  mn += max(x, r1 + s2 - n);
  mn += max(x, s1 + p2 - n);
  mn += max(x, p1 + r2 - n);
  cout << mn << " " << mx << endl;
  return 0;
}
