#include <bits/stdc++.h>
using namespace std;
void __print(int x) { cerr << x; }
void __print(long x) { cerr << x; }
void __print(float x) { cerr << x; }
void __print(double x) { cerr << x; }
void __print(unsigned x) { cerr << x; }
void __print(long long x) { cerr << x; }
void __print(long double x) { cerr << x; }
void __print(unsigned long x) { cerr << x; }
void __print(unsigned long long x) { cerr << x; }
void __print(char x) { cerr << '\'' << x << '\''; }
void __print(bool x) { cerr << (x ? "true" : "false"); }
void __print(const char *x) { cerr << '\"' << x << '\"'; }
void __print(const string &x) { cerr << '\"' << x << '\"'; }
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...);
}
struct _ {
  ios_base::Init i;
  _() { ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL); }
} _;
int dx[] = {-1, 0, 1, 0, -1, -1, 1, 1};
int dy[] = {0, 1, 0, -1, -1, 1, 1, -1};
int main() {
  int n;
  cin >> n;
  vector<pair<int, int>> p(3);
  cin >> p[0].first >> p[1].first >> p[2].first >> p[0].second >> p[1].second >>
      p[2].second;
  ;
  int min_ans = INT_MAX;
  for (auto rep : {0, 1, 2}) {
    int a1 = p[0].first, a2 = p[1].first, a3 = p[2].first;
    int b1 = p[0].second, b2 = p[1].second, b3 = p[2].second;
    int t1 = min(a1, b3);
    int t11 = min(a1 - t1, b1);
    int t2 = min(a2, b1 - t11);
    int t22 = min(a2 - t2, b2);
    int t3 = min(a3, b2 - t22);
    int t33 = min(a3 - t3, b3 - t1);
    min_ans = min(min_ans, a1 - t1 - t11 + a2 - t2 - t22 + a3 - t3 - t33);
    rotate(p.begin(), p.begin() + 1, p.end());
  };
  int max_ans = INT_MIN;
  for (auto rep : {0, 1, 2}) {
    int a1 = p[0].first, a2 = p[1].first, a3 = p[2].first;
    int b1 = p[0].second, b2 = p[1].second, b3 = p[2].second;
    int t1 = min(a1, b2);
    int t11 = min(a1 - t1, b1);
    int t2 = min(a2, b3);
    int t22 = min(a2 - t2, b2 - t1);
    int t3 = min(a3, b1 - t11);
    int t33 = min(a3 - t3, b3 - t2);
    ;
    max_ans = max(max_ans, t1 + t2 + t3);
    rotate(p.begin(), p.begin() + 1, p.end());
  }
  cout << min_ans << " " << max_ans;
  return 0;
}
