#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9;
int main() {
  int n;
  cin >> n;
  int a[4], b[4];
  cin >> a[1] >> a[2] >> a[3];
  cin >> b[1] >> b[2] >> b[3];
  int mn = max(0, a[1] - b[1] - b[3]) + max(0, a[2] - b[2] - b[1]) +
           max(0, a[3] - b[3] - b[2]);
  int mx = min(a[1], b[2]) + min(a[2], b[3]) + min(a[3], b[1]);
  cout << mn << ' ' << mx << endl;
}
