#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  int q = 1, i, j, k;
  while (q--) {
    int n;
    cin >> n;
    int a[3], b[3];
    for (i = 0; i < (3); i++) cin >> a[i];
    for (i = 0; i < (3); i++) cin >> b[i];
    int win = 0, lose = INT_MAX;
    win = min(a[0], b[1]) + min(a[1], b[2]) + min(a[2], b[0]);
    lose = max({a[0] - b[0] - b[2], a[1] - b[1] - b[0], a[2] - b[2] - b[1], 0});
    cout << lose << " " << win;
  }
}
