#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long total;
  cin >> total;
  long long a, b, c, x, y, z;
  cin >> a >> b >> c >> x >> y >> z;
  vector<long long> one({a, b, c});
  vector<long long> two({x, y, z});
  vector<vector<int> > vec;
  vec.push_back({0, 0});
  vec.push_back({0, 2});
  vec.push_back({1, 1});
  vec.push_back({1, 0});
  vec.push_back({2, 2});
  vec.push_back({2, 1});
  long long min_val = INT_MAX;
  do {
    vector<long long> p = one, q = two;
    for (int i = 0; i < 6; i++) {
      long long count = min(p[vec[i][0]], q[vec[i][1]]);
      p[vec[i][0]] -= count;
      q[vec[i][1]] -= count;
    }
    min_val = min(min_val, min(p[0], q[1]) + min(p[1], q[2]) + min(p[2], q[0]));
  } while (next_permutation(vec.begin(), vec.end()));
  long long max_val = 0;
  max_val += min(a, y);
  max_val += min(b, z);
  max_val += min(c, x);
  cout << min_val << " " << max_val << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  solve();
}
