#include <bits/stdc++.h>
using namespace std;
void fun(int aa[], int bb[], int q, int w) {
  int j = min(aa[q], bb[w]);
  aa[q] -= j;
  bb[w] -= j;
};
int main() {
  int i, j = 0, k, l = 0, o[3], p[3], oo[3], pp[3];
  cin >> k;
  cin >> p[0] >> p[1] >> p[2];
  cin >> o[0] >> o[1] >> o[2];
  oo[0] = o[0];
  oo[1] = o[1];
  oo[2] = o[2];
  i += min(p[0], o[1]) + min(p[1], o[2]) + min(p[2], o[0]);
  oo[0] = o[0];
  oo[1] = o[1];
  oo[2] = o[2];
  pp[0] = p[0];
  pp[1] = p[1];
  pp[2] = p[2];
  j += min(oo[0], pp[0]);
  fun(oo, pp, 0, 0);
  j += min(oo[0], pp[1]);
  fun(oo, pp, 0, 1);
  j += min(oo[1], pp[1]);
  fun(oo, pp, 1, 1);
  j += min(oo[1], pp[2]);
  fun(oo, pp, 1, 2);
  if (min(oo[0], pp[2]) > min(oo[1], pp[0])) {
    j += min(oo[2], pp[2]);
    fun(oo, pp, 2, 2);
    j += min(oo[2], pp[0]);
    fun(oo, pp, 2, 0);
  } else {
    j += min(oo[2], pp[0]);
    fun(oo, pp, 2, 0);
    j += min(oo[2], pp[2]);
    fun(oo, pp, 2, 2);
  }
  l = max(l, j);
  j = 0;
  oo[0] = o[0];
  oo[1] = o[1];
  oo[2] = o[2];
  pp[0] = p[0];
  pp[1] = p[1];
  pp[2] = p[2];
  j += min(oo[0], pp[1]);
  fun(oo, pp, 0, 1);
  j += min(oo[0], pp[0]);
  fun(oo, pp, 0, 0);
  j += min(oo[2], pp[0]);
  fun(oo, pp, 2, 0);
  j += min(oo[2], pp[2]);
  fun(oo, pp, 2, 2);
  if (min(oo[2], pp[1]) > min(oo[0], pp[2])) {
    j += min(oo[1], pp[1]);
    fun(oo, pp, 1, 1);
    j += min(oo[1], pp[2]);
    fun(oo, pp, 1, 2);
  } else {
    j += min(oo[1], pp[2]);
    fun(oo, pp, 1, 2);
    j += min(oo[1], pp[1]);
    fun(oo, pp, 1, 1);
  }
  l = max(l, j);
  j = 0;
  oo[0] = o[0];
  oo[1] = o[1];
  oo[2] = o[2];
  pp[0] = p[0];
  pp[1] = p[1];
  pp[2] = p[2];
  j += min(oo[1], pp[1]);
  fun(oo, pp, 1, 1);
  j += min(oo[1], pp[2]);
  fun(oo, pp, 1, 2);
  j += min(oo[2], pp[2]);
  fun(oo, pp, 2, 2);
  j += min(oo[2], pp[0]);
  fun(oo, pp, 2, 0);
  if (min(oo[1], pp[0]) > min(oo[2], pp[1])) {
    j += min(oo[0], pp[0]);
    fun(oo, pp, 0, 0);
    j += min(oo[0], pp[1]);
    fun(oo, pp, 0, 1);
  } else {
    j += min(oo[0], pp[1]);
    fun(oo, pp, 0, 1);
    j += min(oo[0], pp[0]);
    fun(oo, pp, 0, 0);
  }
  l = max(l, j);
  j = 0;
  oo[0] = o[0];
  oo[1] = o[1];
  oo[2] = o[2];
  pp[0] = p[0];
  pp[1] = p[1];
  pp[2] = p[2];
  j += min(oo[1], pp[2]);
  fun(oo, pp, 1, 2);
  j += min(oo[1], pp[1]);
  fun(oo, pp, 1, 1);
  j += min(oo[0], pp[1]);
  fun(oo, pp, 0, 1);
  j += min(oo[0], pp[0]);
  fun(oo, pp, 0, 0);
  if (min(oo[0], pp[2]) > min(oo[1], pp[0])) {
    j += min(oo[2], pp[2]);
    fun(oo, pp, 2, 2);
    j += min(oo[2], pp[0]);
    fun(oo, pp, 2, 0);
  } else {
    j += min(oo[2], pp[0]);
    fun(oo, pp, 2, 0);
    j += min(oo[2], pp[2]);
    fun(oo, pp, 2, 2);
  }
  l = max(l, j);
  j = 0;
  j = 0;
  oo[0] = o[0];
  oo[1] = o[1];
  oo[2] = o[2];
  pp[0] = p[0];
  pp[1] = p[1];
  pp[2] = p[2];
  j += min(oo[2], pp[2]);
  fun(oo, pp, 2, 2);
  j += min(oo[2], pp[0]);
  fun(oo, pp, 2, 0);
  j += min(oo[0], pp[0]);
  fun(oo, pp, 0, 0);
  j += min(oo[0], pp[1]);
  fun(oo, pp, 0, 1);
  if (min(oo[2], pp[1]) > min(oo[0], pp[2])) {
    j += min(oo[1], pp[1]);
    fun(oo, pp, 1, 1);
    j += min(oo[1], pp[2]);
    fun(oo, pp, 1, 2);
  } else {
    j += min(oo[1], pp[2]);
    fun(oo, pp, 1, 2);
    j += min(oo[1], pp[1]);
    fun(oo, pp, 1, 1);
  }
  l = max(l, j);
  j = 0;
  oo[0] = o[0];
  oo[1] = o[1];
  oo[2] = o[2];
  pp[0] = p[0];
  pp[1] = p[1];
  pp[2] = p[2];
  j += min(oo[2], pp[0]);
  fun(oo, pp, 2, 0);
  j += min(oo[2], pp[2]);
  fun(oo, pp, 2, 2);
  j += min(oo[1], pp[2]);
  fun(oo, pp, 1, 2);
  j += min(oo[1], pp[1]);
  fun(oo, pp, 1, 1);
  if (min(oo[1], pp[0]) > min(oo[2], pp[1])) {
    j += min(oo[0], pp[0]);
    fun(oo, pp, 0, 0);
    j += min(oo[0], pp[1]);
    fun(oo, pp, 0, 1);
  } else {
    j += min(oo[0], pp[1]);
    fun(oo, pp, 0, 1);
    j += min(oo[0], pp[0]);
    fun(oo, pp, 0, 0);
  }
  l = max(l, j);
  j = 0;
  ;
  cout << k - l << " " << i;
  ;
  return 0;
}
