#include <bits/stdc++.h>
constexpr auto Inf = 0X3F3F3F3F;
using namespace std;
namespace IO {
inline long long read() {
  long long o = 0, f = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c > '/' && c < ':') {
    o = o * 10 + c - '0';
    c = getchar();
  }
  return o * f;
}
inline char recd() {
  char o;
  while ((o = getchar()) < '0' || o > '9')
    ;
  return o;
}
inline double reod() {
  double o = read(), f = 1;
  char c;
  while ((c = getchar()) > '/' && c < ':') o += (c - '0') / (f *= 10);
  return o;
}
}  // namespace IO
using namespace IO;
const int SIZE = 2E5 + 7, Mod = (1E9 + 7, 998244353);
typedef struct {
  int next, to, w;
} Edge;
Edge edge[SIZE << 1];
int head[SIZE << 1], Deep[SIZE], cnt, Point, aimT;
queue<int> que;
void add(int form, int to, int w) {
  edge[cnt].to = to;
  edge[cnt].w = w;
  edge[cnt].next = head[form];
  head[form] = cnt++;
}
int BFS(int S, int T) {
  memset(Deep, 0, sizeof Deep);
  while (!que.empty()) que.pop();
  Deep[S] = 1;
  que.push(S);
  while (!que.empty()) {
    int now = que.front();
    que.pop();
    for (int pos = head[now]; ~pos; pos = edge[pos].next)
      if (edge[pos].w && !Deep[edge[pos].to]) {
        Deep[edge[pos].to] = Deep[now] + 1;
        que.push(edge[pos].to);
      }
  }
  return Deep[T];
}
int DFS(int now, int rem) {
  if (now == aimT) return rem;
  int all_flow = 0;
  for (int pos = head[now]; ~pos && rem; pos = edge[pos].next) {
    if (edge[pos].w && Deep[edge[pos].to] == Deep[now] + 1) {
      int add_flow = DFS(edge[pos].to, min(rem, edge[pos].w));
      edge[pos].w -= add_flow;
      edge[pos ^ 1].w += add_flow;
      rem -= add_flow;
      all_flow += add_flow;
    }
    if (!rem) break;
  }
  if (rem) Deep[now] = -1;
  return all_flow;
}
int Dinic(int S, int T) {
  aimT = T;
  int ans = 0;
  while (BFS(S, T)) ans += DFS(S, Inf);
  return ans;
}
int main() {
  int N = read();
  int X = read(), Y = read(), Z = read();
  int A = read(), B = read(), C = read();
  int MA = min(X, B) + min(Y, C) + min(A, Z);
  memset(head, -1, sizeof head);
  add(1, 2, X);
  add(2, 1, 0);
  add(1, 3, Y);
  add(3, 1, 0);
  add(1, 4, Z);
  add(4, 1, 0);
  add(2, 5, Inf);
  add(5, 2, 0);
  add(2, 7, Inf);
  add(7, 2, 0);
  add(3, 5, Inf);
  add(5, 3, 0);
  add(3, 6, Inf);
  add(6, 3, 0);
  add(4, 6, Inf);
  add(6, 4, 0);
  add(4, 7, Inf);
  add(7, 4, 0);
  add(5, 8, A);
  add(8, 5, 0);
  add(6, 8, B);
  add(8, 6, 0);
  add(7, 8, C);
  add(8, 7, 0);
  int MI = Dinic(1, 8);
  printf("%d %d\n", N - MI, MA);
}
