#include <bits/stdc++.h>
using namespace std;
int t, cas = 1;
int a[5], b[5];
int n, i, j, q, x, y, z, sum, mx, mn;
int maxi(int a[], int b[]) {
  return min(a[0], b[1]) + min(a[1], b[2]) + min(a[2], b[0]);
}
int main() {
  cin >> n;
  mn = INT_MAX;
  for (i = 0; i < 3; i++) cin >> a[i];
  for (i = 0; i < 3; i++) cin >> b[i];
  mx = maxi(a, b);
  pair<int, int> aa[7];
  aa[0] = {0, 0};
  aa[1] = {0, 2};
  aa[2] = {1, 0};
  aa[3] = {1, 1};
  aa[4] = {2, 1};
  aa[5] = {2, 2};
  for (i = 0; i < 720; i++) {
    int tem_a[5], tem_b[5];
    for (j = 0; j < 3; j++) tem_a[j] = a[j], tem_b[j] = b[j];
    for (j = 0; j < 6; j++) {
      z = min(tem_a[aa[j].first], tem_b[aa[j].second]);
      tem_a[aa[j].first] -= z;
      tem_b[aa[j].second] -= z;
    }
    sum = maxi(tem_a, tem_b);
    mn = min(sum, mn);
    next_permutation(aa, aa + 6);
  }
  cout << mn << " " << mx;
}
