#include <bits/stdc++.h>
using namespace std;
void __print(int x) { cerr << x; }
void __print(long x) { cerr << x; }
void __print(long long x) { cerr << x; }
void __print(unsigned x) { cerr << x; }
void __print(unsigned long x) { cerr << x; }
void __print(unsigned long long x) { cerr << x; }
void __print(float x) { cerr << x; }
void __print(double x) { cerr << x; }
void __print(long double x) { cerr << x; }
void __print(char x) { cerr << '\'' << x << '\''; }
void __print(const char *x) { cerr << '\"' << x << '\"'; }
void __print(const string &x) { cerr << '\"' << x << '\"'; }
void __print(bool x) { cerr << (x ? "true" : "false"); }
template <typename T, typename V>
void __print(const pair<T, V> &x) {
  cerr << '{';
  __print(x.first);
  cerr << ',';
  __print(x.second);
  cerr << '}';
}
template <typename T>
void __print(const T &x) {
  int f = 0;
  cerr << '{';
  for (auto &i : x) cerr << (f++ ? "," : ""), __print(i);
  cerr << "}";
}
void _print() { cerr << "]\n"; }
template <typename T, typename... V>
void _print(T t, V... v) {
  __print(t);
  if (sizeof...(v)) cerr << ", ";
  _print(v...);
}
void test_case() {
  long long n;
  cin >> n;
  long long minVal = INT_MAX;
  long long maxVal = INT_MIN;
  vector<long long> a(3);
  vector<long long> b(3);
  for (long long i = 0; i < 3; i++) {
    cin >> a[i];
  }
  for (long long i = 0; i < 3; i++) {
    cin >> b[i];
  }
  vector<pair<long long, long long>> ord(6);
  ord[0] = {0, 0};
  ord[1] = {0, 2};
  ord[2] = {1, 0};
  ord[3] = {1, 1};
  ord[4] = {2, 1};
  ord[5] = {2, 2};
  sort(ord.begin(), ord.end());
  do {
    vector<long long> x = a;
    vector<long long> y = b;
    for (long long i = 0; i < 6; i++) {
      long long c = min(x[ord[i].first], y[ord[i].second]);
      x[ord[i].first] -= c;
      y[ord[i].second] -= c;
    }
    long long val = min(x[0], y[1]) + min(x[1], y[2]) + min(x[2], y[0]);
    minVal = min(val, minVal);
  } while (next_permutation(ord.begin(), ord.end()));
  maxVal = min(a[0], b[1]) + min(a[1], b[2]) + min(a[2], b[0]);
  cout << minVal << " " << maxVal << endl;
}
int main() {
  long long T = 1;
  while (T--) {
    test_case();
  }
}
