#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 7;
const double eps = 1e-10;
const int inf = 0x3f3f3f3f;
const int mod = 998244353;
int t;
int n, m;
int a1, b1, c1;
int a2, b2, c2;
void solve() {
  cin >> a1 >> b1 >> c1 >> a2 >> b2 >> c2;
  int mi = inf, ma = min(a1, b2) + min(b1, c2) + min(c1, a2);
  int x = a2 + c2;
  int y = a2 + b2;
  int z = b2 + c2;
  mi = n - min(a1, x) - min(b1, y) - min(c1, z);
  cout << mi << ' ' << ma << '\n';
}
int main() {
  cin >> n;
  solve();
  return 0;
}
