#include <bits/stdc++.h>
using namespace std;
void Debug(string var, int val) {
  cout << "Debug: "
       << "\n";
  cout << var << " = " << val << "\n";
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int q0 = 1;
  while (q0--) {
    int n;
    cin >> n;
    vector<int> a(3), b(3);
    cin >> a[0] >> a[1] >> a[2];
    cin >> b[0] >> b[1] >> b[2];
    vector<pair<int, int>> order;
    order.push_back({0, 0});
    order.push_back({1, 1});
    order.push_back({2, 2});
    order.push_back({0, 2});
    order.push_back({1, 0});
    order.push_back({2, 1});
    int min_ans = INT_MAX;
    sort(order.begin(), order.end());
    do {
      vector<int> a1 = a, b1 = b;
      for (int i = 0; i < order.size(); i++) {
        int cnt = min(a1[order[i].first], b1[order[i].second]);
        a1[order[i].first] -= cnt;
        b1[order[i].second] -= cnt;
      }
      int cur = min(a1[0], b1[1]) + min(a1[1], b1[2]) + min(a1[2], b1[0]);
      min_ans = min(cur, min_ans);
    } while (next_permutation(order.begin(), order.end()));
    int max_ans = min(a[0], b[1]) + min(a[1], b[2]) + min(a[2], b[0]);
    cout << min_ans << " " << max_ans;
  }
  return 0;
}
