#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e4 + 4;
int main() {
  int n, a1, a2, a3, b1, b2, b3;
  int c1, c2, c3;
  cin >> n;
  cin >> a1 >> a2 >> a3;
  cin >> b1 >> b2 >> b3;
  int ans1 = 0, ans2 = 0;
  ans1 = max(0, max(a1 - b1 - b3, max(a2 - b1 - b2, a3 - b2 - b3)));
  ans2 = min(a1, b2) + min(a2, b3) + min(a3, b1);
  printf("%d %d\n", ans1, ans2);
}
