#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed;
  cout << setprecision(10);
  long long n, a1, a2, a3, b1, b2, b3;
  cin >> n >> a1 >> a2 >> a3 >> b1 >> b2 >> b3;
  long long minwin, maxwin;
  { maxwin = min(a1, b2) + min(a2, b3) + min(a3, b1); }
  { minwin = n - (min(b1, a1 + a2) + min(b2, a2 + a3) + min(b3, a3 + a1)); }
  cout << minwin << " " << maxwin << "\n";
  return 0;
}
