#include <bits/stdc++.h>
using namespace std;
int a[3];
int b[3];
int c[3], d[3];
int sum = 0;
int main() {
  int t;
  cin >> t;
  for (int i = 0; i < 3; i++) {
    cin >> a[i];
    c[i] = a[i];
  }
  for (int j = 0; j < 3; j++) {
    cin >> b[j];
    d[j] = b[j];
  }
  int maxn = 0, minn = 0;
  if (c[0] >= d[1]) {
    maxn += d[1];
  } else {
    maxn += c[0];
  }
  if (c[1] >= d[2]) {
    maxn += d[2];
  } else
    maxn += c[1];
  if (c[2] >= d[0]) {
    maxn += d[0];
  } else
    maxn += c[2];
  for (int i = 0; i < 3; i++) {
    sum = max(b[i] - a[i] - a[(i + 1) % 3], sum);
  }
  cout << sum << " " << maxn << endl;
  return 0;
}
