#include <bits/stdc++.h>
const int mod = 1e9 + 7;
bool is_prime(long long);
using namespace std;
void solve() {
  int n;
  cin >> n;
  int a1, a2, a3;
  cin >> a1 >> a2 >> a3;
  int b1, b2, b3;
  cin >> b1 >> b2 >> b3;
  int maxi = min(a1, b2) + min(a2, b3) + min(a3, b1);
  int ans2 = n - (min(a1, b1 + b3) + min(a2, b2 + b1) + min(a3, b2 + b3));
  cout << ans2 << " " << maxi << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
bool is_prime(long long n) {
  if (n == 1) {
    return false;
  }
  int i = 2;
  while (i * i <= n) {
    if (n % i == 0) {
      return false;
    }
    i += 1;
  }
  return true;
}
