#include <bits/stdc++.h>
using namespace std;
template <typename T>
T min(T a, T b, T c) {
  return min(a, min(b, c));
}
template <typename T>
T max(T a, T b, T c) {
  return max(a, max(b, c));
}
template <typename T>
T max(T a, T b, T c, T d) {
  return max(a, max(b, max(c, d)));
}
template <typename T>
T min(T a, T b, T c, T d) {
  return min(a, min(b, min(c, d)));
}
template <typename t1>
void fill(vector<t1> &arr, t1 val) {
  for (long long i = 0; i < (long long)arr.size(); i++) arr[i] = val;
}
template <typename t1>
void fill(vector<vector<t1>> &arr, t1 val) {
  for (long long i = 0; i < (long long)arr.size(); i++) {
    for (long long j = 0; j < (long long)arr[i].size(); j++) arr[i][j] = val;
  }
}
template <typename T>
void read(vector<T> &arr, long long N) {
  arr.clear();
  arr.resize(N);
  for (long long i = 0; i < N; i++) cin >> arr[i];
}
template <typename T>
void read(vector<pair<T, T>> &arr, long long N) {
  arr.clear();
  arr.resize(N);
  for (long long i = 0; i < (long long)arr.size(); i++)
    cin >> arr[i].first >> arr[i].second;
}
template <typename T>
void read(vector<vector<T>> &arr, long long N, long long M) {
  arr.clear();
  arr.resize(N, vector<T>(M));
  for (long long i = 0; i < N; i++) {
    for (long long j = 0; j < M; j++) cin >> arr[i][j];
  }
}
template <typename T, size_t N>
long long SIZE(const T (&t)[N]) {
  return N;
}
template <typename T>
long long SIZE(const T &t) {
  return t.size();
}
string to_string(const string s, long long x1 = 0, long long x2 = 1e9) {
  return '"' + ((x1 < s.size()) ? s.substr(x1, x2 - x1 + 1) : "") + '"';
}
string to_string(const char *s) { return to_string((string)s); }
string to_string(const bool b) { return (b ? "true" : "false"); }
string to_string(const char c) { return string({c}); }
template <size_t N>
string to_string(const bitset<N> &b, long long x1 = 0, long long x2 = 1e9) {
  string t = "";
  for (long long __iii__ = min(x1, SIZE(b)), __jjj__ = min(x2, SIZE(b) - 1);
       __iii__ <= __jjj__; ++__iii__) {
    t += b[__iii__] + '0';
  }
  return '"' + t + '"';
}
template <typename A, typename... C>
string to_string(const A(&v), long long x1 = 0, long long x2 = 1e9,
                 C... coords);
long long l_v_l_v_l = 0, t_a_b_s = 0;
template <typename A, typename B>
string to_string(const pair<A, B> &p) {
  l_v_l_v_l++;
  string res = "" + to_string(p.first) + ", " + to_string(p.second) + "";
  l_v_l_v_l--;
  return res;
}
template <typename A, typename... C>
string to_string(const A(&v), long long x1, long long x2, C... coords) {
  long long rnk = rank<A>::value;
  string tab(t_a_b_s, ' ');
  string res = "";
  bool first = true;
  if (l_v_l_v_l == 0) res += '\n';
  res += tab + "[ ";
  x1 = min(x1, SIZE(v)), x2 = min(x2, SIZE(v));
  auto l = begin(v);
  advance(l, x1);
  auto r = l;
  advance(r, (x2 - x1) + (x2 < SIZE(v)));
  for (auto e = l; e != r; e = next(e)) {
    if (!first) {
      res += ", ";
    }
    first = false;
    l_v_l_v_l++;
    if (e != l) {
      if (rnk > 1) {
        res += '\n';
        t_a_b_s = l_v_l_v_l;
      };
    } else {
      t_a_b_s = 0;
    }
    res += to_string(*e, coords...);
    l_v_l_v_l--;
  }
  res += "]\n";
  if (l_v_l_v_l == 0) res += '\n';
  return res;
}
void dbgm() { ; }
template <typename Heads, typename... Tails>
void dbgm(Heads H, Tails... T) {
  cout << to_string(H) << " | ";
  dbgm(T...);
}
static bool comp(pair<long long, long long> &a, pair<long long, long long> &b) {
}
const long long Max = 2 * 1e17, Min = -2 * 1e17;
const long long mod = 1e9 + 7;
long long N, M, K;
const long long P = 31;
void solve() {
  cin >> N;
  vector<long long> a(3), b(3);
  cin >> a[0] >> a[1] >> a[2];
  cin >> b[0] >> b[1] >> b[2];
  long long ansmax = 0;
  ansmax += min(a[0], b[1]);
  ansmax += min(a[1], b[2]);
  ansmax += min(a[2], b[0]);
  vector<pair<long long, long long>> perm = {{0, 0}, {0, 2}, {1, 1},
                                             {1, 0}, {2, 2}, {2, 1}};
  sort(perm.begin(), perm.end());
  long long ansmin = Max;
  for (long long ii = 0; ii < 1000; ii++) {
    vector<long long> newa = a, newb = b;
    for (long long j = 0; j < 6; j++) {
      long long neg = min(newa[perm[j].first], newb[perm[j].second]);
      newa[perm[j].first] -= neg;
      newb[perm[j].second] -= neg;
    }
    long long still =
        min(newa[0], newb[1]) + min(newa[1], newb[2]) + min(newa[2], newb[0]);
    ansmin = min(ansmin, still);
    next_permutation(perm.begin(), perm.end());
  }
  cout << ansmin << ' ' << ansmax << '\n';
}
signed main() {
  bool testcases = 0;
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  if (testcases) {
    long long tt;
    cin >> tt;
    while (tt--) solve();
  } else
    solve();
}
