#include <bits/stdc++.h>
using namespace std;
inline bool isvowel(char ch) {
  ch = tolower(ch);
  return (ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch == 'u');
}
inline bool isprime(int n) {
  if (n < 2 || (n % 2 == 0 && n != 2)) return false;
  for (int i = 3; i * i <= n; i++)
    if (n % i == 0) return false;
  return true;
}
class Union {
 private:
  vector<int> saizu, link, l;

 public:
  Union(int n) {
    saizu.assign(n, 1);
    link.resize(n);
    l.resize(n);
    iota(link.begin(), link.end(), 0);
    iota(l.begin(), l.end(), 0);
  }
  int find(int n) {
    if (link[n] == n) return n;
    return link[n] = find(link[n]);
  }
  int same(int a, int b) { return find(a) == find(b); }
  void unite(int a, int b) {
    if (same(a, b)) return;
    a = find(a);
    b = find(b);
    if (saizu[a] < saizu[b]) swap(a, b);
    saizu[a] += saizu[b];
    link[b] = a;
    l[a] = min(l[a], l[b]);
  }
  int getsize(int a) { return saizu[find(a)]; }
  int getl(int a) { return l[find(a)]; }
};
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, i;
  vector<int> a(3), b(3);
  cin >> n;
  cin >> a[0] >> a[1] >> a[2];
  cin >> b[0] >> b[1] >> b[2];
  vector<pair<int, int> > order;
  order.push_back(make_pair(0, 0));
  order.push_back(make_pair(0, 2));
  order.push_back(make_pair(1, 0));
  order.push_back(make_pair(1, 1));
  order.push_back(make_pair(2, 1));
  order.push_back(make_pair(2, 2));
  int mn = 2e9;
  do {
    auto a1 = a, b1 = b;
    for (i = 0; i < 6; i++) {
      int mnn = min(a1[order[i].first], b1[order[i].second]);
      a1[order[i].first] -= mnn;
      b1[order[i].second] -= mnn;
    }
    mn = min(min(a1[0], b1[1]) + min(a1[1], b1[2]) + min(a1[2], b1[0]), mn);
  } while (next_permutation(order.begin(), order.end()));
  cout << mn << ' ' << min(a[0], b[1]) + min(a[1], b[2]) + min(a[2], b[0]);
  return 0;
}
