#include <bits/stdc++.h>
using namespace std;
const long long M = 1e9 + 7;
const int N = 1e6 + 7;
vector<pair<int, int>> order;
vector<int> a, b;
int getAns() {
  int ans = INT_MAX;
  sort(order.begin(), order.end());
  do {
    vector<int> a1 = a, b1 = b;
    for (long long i = 0; i < (int)order.size(); i++) {
      int x = min(a1[order[i].first], b1[order[i].second]);
      a1[order[i].first] -= x;
      b1[order[i].second] -= x;
    }
    int ans1 = a1[0] + a1[1] + a1[2];
    ans = min(ans, ans1);
  } while (next_permutation(order.begin(), order.end()));
  return ans;
}
int main() {
  int n;
  cin >> n;
  for (long long i = 0; i < (int)3; i++) {
    int x;
    cin >> x;
    a.push_back(x);
  }
  for (long long i = 0; i < (int)3; i++) {
    int x;
    cin >> x;
    b.push_back(x);
  }
  order.push_back({0, 2});
  order.push_back({0, 0});
  order.push_back({1, 0});
  order.push_back({1, 1});
  order.push_back({2, 1});
  order.push_back({2, 2});
  int minans = getAns();
  int maxans = min(a[0], b[1]) + min(a[1], b[2]) + min(a[2], b[0]);
  cout << minans << " " << maxans;
  return 0;
}
