#include <bits/stdc++.h>
using namespace std;
class Solution {
 public:
  pair<int, int> solve(vector<int>& A, vector<int>& B) {
    int n = A.size();
    vector<int> ordA(n, 0);
    iota(ordA.begin(), ordA.end(), 0);
    vector<int> ordB(n, 0);
    iota(ordB.begin(), ordB.end(), 0);
    int N = 0;
    for (auto x : A) {
      N += x;
    }
    auto play = [&](vector<int>& oa, vector<int>& ob) {
      int ans = 0;
      int rnd = 0;
      vector<int> cntA(A);
      vector<int> cntB(B);
      for (int i = 0, j = 0; rnd < N;) {
        int a = oa[i];
        int b = ob[j];
        int cnt = min(cntA[a], cntB[b]);
        if ((a + 1) % n == b) {
          ans += cnt;
        }
        cntA[a] -= cnt;
        cntB[b] -= cnt;
        rnd += cnt;
        if (cntA[a] == 0) {
          ++i;
        }
        if (cntB[b] == 0) {
          ++j;
        }
      }
      return ans;
    };
    int mx = 0;
    int mn = N;
    do {
      do {
        int ans = play(ordA, ordB);
        mx = max(mx, ans);
        mn = min(mn, ans);
      } while (next_permutation(ordB.begin(), ordB.end()));
    } while (next_permutation(ordA.begin(), ordA.end()));
    return {mn, mx};
  }
};
int main(int argc, char** argv) {
  ios::sync_with_stdio(false);
  cin.tie(0);
  Solution sol;
  int n;
  cin >> n;
  vector<int> A(3);
  vector<int> B(3);
  for (int i = 0; i < 3; ++i) {
    cin >> A[i];
  }
  for (int i = 0; i < 3; ++i) {
    cin >> B[i];
  }
  auto res = sol.solve(A, B);
  cout << res.first << " " << res.second << '\n';
  return 0;
}
