#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false), cout.tie(0), cin.tie(0);
  int n;
  cin >> n;
  int a1, a2, a3, b1, b2, b3;
  cin >> a2 >> a1 >> a3 >> b2 >> b1 >> b3;
  int r1 = 0, r2 = 0;
  r2 = min(a1, b3) + min(a2, b1) + min(a3, b2);
  r1 = max(r1, a1 - b1 - b2);
  r1 = max(r1, a2 - b2 - b3);
  r1 = max(r1, a3 - b3 - b1);
  cout << r1 << " " << r2 << '\n';
  return 0;
}
