#include <bits/stdc++.h>
using namespace std;
bool compare(const pair<int, double> &i, const pair<int, double> &j) {
  return i.second < j.second;
}
int gcd(int a, int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
void FastIO() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
}
void txtINPUT() {
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
}
bool comparator(const pair<string, int> &p1, const pair<string, int> &p2) {
  if (p1.second != p2.second)
    return p1.second > p2.second;
  else
    return p1.first < p2.first;
}
int countBits(int n) {
  int cnt = 0;
  while (n) {
    if (n & 1) cnt++;
    n = n >> 1;
  }
  return cnt;
}
long long fastPower(int x, int y) {
  if (y == 1) return x;
  if (y == 0) return 1;
  if (y % 2) return x * fastPower(x, y - 1);
  long long ans = fastPower(x, y / 2);
  return ans * ans;
}
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
struct dsu {
  vector<int> parent;
  vector<int> size;
  void init(int n) {
    parent.resize(n + 1);
    size.resize(n + 1);
    for (int i = 1; i <= n; i++) {
      parent[i] = i;
      size[i] = 1;
    }
  }
  int root(int node) {
    if (parent[node] == node) return node;
    return parent[node] = root(parent[node]);
  }
  bool isUnion(int node1, int node2) {
    int p1 = root(node1);
    int p2 = root(node2);
    if (p1 == p2) return true;
    return false;
  }
  int getSize(int node) {
    int p = root(node);
    return size[p];
  }
  void link(int node1, int node2) {
    int p1 = root(node1);
    int p2 = root(node2);
    if (size[p1] > size[p2]) swap(p1, p2);
    parent[p1] = p2;
    size[p2] += size[p1];
  }
};
bool ok = false;
const int OO = (int)1e8;
const double EPS = (1e-7);
const int maxN = 100000;
long long n, r1, s1, p1, r2, s2, p2;
int main() {
  FastIO();
  cin >> n >> r1 >> s1 >> p1 >> r2 >> s2 >> p2;
  long long minn, maxx;
  maxx = min(r1, s2) + min(s1, p2) + min(p1, r2);
  minn = max(0LL, r1 - (r2 + p2)) + max(0LL, s1 - (s2 + r2)) +
         max(0LL, p1 - (p2 + s2));
  cout << minn << " " << maxx << "\n";
  return 0;
}
