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