#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n;
  cin >> n;
  long long int a, b, c, x, y, z;
  cin >> a >> b >> c >> x >> y >> z;
  long long int mn = 0, mx = 0;
  mn = max({0LL, a - x - z, b - x - y, c - y - z});
  mx = min(a, y) + min(b, z) + min(c, x);
  cout << mn << " " << mx << "\n";
}
