#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a1, a2, a3, b1, b2, b3;
  cin >> n;
  cin >> a1 >> a2 >> a3 >> b1 >> b2 >> b3;
  long long s1 = max({0, a1 - b1 - b3, a2 - b2 - b1, a3 - b3 - b2});
  long long s2 = min(a1, b2) + min(a2, b3) + min(a3, b1);
  cout << s1 << " " << s2 << endl;
  return 0;
}
