#include <bits/stdc++.h>
using namespace std;
int main() {
  {
    long long int r, n, c, m, i, j, count = 0, x, a, b, y, sum = 0;
    long long int mn = 1e18, mx = 0, ans = 0, k, ind;
    long long int br = 0, T, rz = 0;
    string s = "";
    cin >> n;
    long long int a1, a2, a3, b1, b2, b3;
    cin >> a1 >> a2 >> a3;
    cin >> b1 >> b2 >> b3;
    mx = max(mx, a1 - b1 - b3);
    mx = max(mx, a2 - b1 - b2);
    mx = max(mx, a3 - b2 - b3);
    mn = 0;
    mn += min(a1, b2);
    mn += min(a2, b3);
    mn += min(a3, b1);
    cout << mx << " " << mn << endl;
  }
  return 0;
}
