#include <bits/stdc++.h>
using namespace std;
template <class T>
long long size(const T& x) {
  return x.size();
}
#pragma GCC optimize("Ofast")
template <class T>
T smod(T a, T b) {
  return (a % b + b) % b;
}
void solve() {
  long long n;
  cin >> n;
  long long a1, a2, a3, b1, b2, b3;
  cin >> a1 >> a2 >> a3 >> b1 >> b2 >> b3;
  long long mn = max(0ll, a1 - (b1 + b3)) + max(0ll, a2 - (b1 + b2)) +
                 max(0ll, a3 - (b2 + b3));
  cout << mn << ' ';
  long long mx = min(a1, b2) + min(a2, b3) + min(a3, b1);
  cout << mx << endl;
}
int main() {
  cin.sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  solve();
  return 0;
}
