#include <bits/stdc++.h>
using namespace std;
using pil = pair<long long, long long>;
using pii = pair<int, int>;
using pid = pair<double, double>;
void solve() {
  int n;
  cin >> n;
  int a1, a2, a3;
  cin >> a1 >> a2 >> a3;
  int b1, b2, b3;
  cin >> b1 >> b2 >> b3;
  int minans = 0, maxans = 0;
  maxans = min(a1, b2) + min(a2, b3) + min(a3, b1);
  if (a1 > b1 + b3) minans += a1 - (b1 + b3);
  if (a2 > b1 + b2) minans += a2 - (b2 + b1);
  if (a3 > b2 + b3) minans += a3 - (b3 + b2);
  cout << minans << " " << maxans << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t = 1;
  while (t--) {
    solve();
  }
}
