#include <bits/stdc++.h>
using namespace std;
template <typename... T>
void read(T&... args) {
  ((cin >> args), ...);
}
template <typename... T>
void write(T&... args) {
  ((cout << args << " "), ...);
}
long long int upperBound(long long int a[], long long int n,
                         long long int val) {
  return upper_bound(a, a + n, val) - a;
}
long long int lowerBound(long long int a[], long long int n,
                         long long int val) {
  return lower_bound(a, a + n, val) - a;
}
bool persqr(int a) { return (int(sqrt(a)) * int(sqrt(a)) == a) ? 1 : 0; }
long long int gcd(long long int a, long long int b) {
  return (a ? gcd(b % a, a) : b);
}
bool powerOf2(int a) { return !(a & (a - 1)); }
long long int abs(long long int n1, long long int n2) {
  return n1 > n2 ? n1 - n2 : n2 - n1;
}
long long int power(long long int xx, long long int yy) {
  if (yy == 0) return 1;
  long long int pp = power(xx, yy / 2);
  return (yy % 2 == 0) ? (pp * pp) : (pp * pp * xx);
}
long long int highestPowerof2(long long int n) {
  return power(2, (long long int)log2(n));
}
long long int ans, n, t, ans1, cnt = 0;
long long int dp(long long int a, long long int b, long long int c,
                 long long int x, long long int y, long long int z) {
  cnt++;
  if (a != 0 and x != 0) dp(a - min(a, x), b, c, x - min(a, x), y, z);
  if (a != 0 and z != 0) dp(a - min(a, z), b, c, x, y, z - min(a, z));
  if (b != 0 and y != 0) dp(a, b - min(b, y), c, x, y - min(b, y), z);
  if (b != 0 and x != 0) dp(a, b - min(b, x), c, x - min(b, x), y, z);
  if (c != 0 and z != 0) dp(a, b, c - min(c, z), x, y, z - min(c, z));
  if (c != 0 and y != 0) dp(a, b, c - min(c, y), x, y - min(c, y), z);
  ans1 = min(ans1, a + b + c);
  return 0;
}
int main() {
  ios::sync_with_stdio(0);
  long long int a, b, c, x, y, z;
  read(n, a, b, c, x, y, z);
  ans = min(a, y) + min(b, z) + min(c, x);
  ans1 = a + b + c;
  dp(a, b, c, x, y, z);
  cout << ans1 << " " << ans << endl;
  return 0;
}
