#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
const int MX = 1000005;
static const int arr[] = {1, 2, 3, 4, 5, 6};
int t;
int n;
void solve() {
  cin >> n;
  int a, b, c;
  int d, e, first;
  cin >> a >> b >> c >> d >> e >> first;
  int m = 0, M = 0;
  m = max(m, a - d - first);
  m = max(m, b - e - d);
  m = max(m, c - first - e);
  M = min(a, e) + min(b, first) + min(c, d);
  cout << m << ' ' << M << endl;
}
int main() {
  t = 1;
  for (int i = 0; i < (t); i++) {
    solve();
  }
}
