#include <bits/stdc++.h>
template <typename T>
inline void read(T &x) {
  x = 0;
  char c = getchar();
  bool flag = false;
  while (!isdigit(c)) {
    if (c == '-') flag = true;
    c = getchar();
  }
  while (isdigit(c)) {
    x = (x << 1) + (x << 3) + (c ^ 48);
    c = getchar();
  }
  if (flag) x = -x;
}
using namespace std;
const long long inf = 98765432154321ll;
long long n, s, t;
struct edge {
  long long nxt, to, val;
} e[12345];
long long head[12345], ecnt = 1, hcur[12345];
inline void addedge(long long from, long long to, long long val) {
  e[++ecnt] = (edge){head[from], to, val};
  head[from] = ecnt;
}
inline void Add(long long u, long long v, long long w) {
  addedge(u, v, w), addedge(v, u, 0);
}
long long que[12345], front, rear;
long long dep[12345];
inline bool bfs() {
  front = rear = 0;
  memset(dep, 0x3f, sizeof(dep));
  for (long long i = 1; i <= t; ++i) hcur[i] = head[i];
  dep[s] = 0;
  que[++rear] = s;
  while (front < rear) {
    long long cur = que[++front];
    for (long long i = head[cur]; i; i = e[i].nxt) {
      long long to = e[i].to;
      if (!e[i].val || dep[to] < inf) continue;
      dep[to] = dep[cur] + 1;
      que[++rear] = to;
    }
  }
  return dep[t] <= inf;
}
long long dfs(long long cur, long long limi) {
  if (cur == t || !limi) return limi;
  long long flow = 0;
  for (long long i = hcur[cur]; i; i = e[i].nxt) {
    long long to = e[i].to;
    hcur[cur] = i;
    if (dep[to] != dep[cur] + 1) continue;
    long long tmp = dfs(to, min(e[i].val, limi));
    if (!tmp) continue;
    flow += tmp;
    limi -= tmp;
    e[i].val -= tmp;
    e[i ^ 1].val += tmp;
    if (!limi) break;
  }
  return flow;
}
signed main() {
  long long a1, b1, c1, a2, b2, c2;
  read(n), read(a1), read(b1), read(c1);
  read(a2), read(b2), read(c2);
  s = 7, t = 8;
  Add(s, 1, a1), Add(s, 2, b1), Add(s, 3, c1);
  Add(1, 4, inf), Add(2, 5, inf), Add(3, 6, inf);
  Add(1, 6, inf), Add(2, 4, inf), Add(3, 5, inf);
  Add(4, t, a2), Add(5, t, b2), Add(6, t, c2);
  long long ans1 = 0;
  long long ans2 = min(a1, b2) + min(b1, c2) + min(c1, a2);
  while (bfs()) {
    ans1 += dfs(s, inf);
  }
  printf("%lld %lld\n", n - ans1, ans2);
  return 0;
}
