#include <bits/stdc++.h>
using namespace std;
int main() {
  int num;
  cin >> num;
  int x[3], y[3];
  for (int i = 0; i < 3; i++) {
    cin >> x[i];
  }
  for (int i = 0; i < 3; i++) {
    cin >> y[i];
  }
  int sum[3];
  int flag, p;
  for (int i = 0; i < 3; i++) {
    flag = i + 1;
    if (flag == 3) {
      flag = 0;
    }
    if (x[i] != 0 && y[flag] != 0) {
      p = x[i] - y[flag];
      if (p >= 0) {
        sum[i] = x[i] - p;
      } else {
        sum[i] = x[i];
      }
    } else {
      sum[i] = 0;
    }
  }
  int swap;
  swap = x[2];
  x[2] = x[1];
  x[1] = swap;
  swap = y[2];
  y[2] = y[1];
  y[1] = swap;
  int result[3];
  int flag1, flag2;
  int x1[3], y1[3];
  int total = 0;
  for (int i = 0; i < 3; i++) {
    total = 0;
    copy(begin(x), end(x), begin(x1));
    copy(begin(y), end(y), begin(y1));
    for (int j = i; j <= i + 2; j++) {
      flag1 = j;
      flag2 = j + 1;
      if (flag2 > 2) {
        flag2 = flag2 - 3;
      }
      if (flag1 > 2) {
        flag1 = flag1 - 3;
      }
      if (x1[flag1] > 0 && y1[flag2] > 0) {
        p = x1[flag1] - y1[flag2];
        if (p >= 0) {
          total = total + x1[flag1] - p;
          y1[flag2] = 0;
          x1[flag1] = p;
          if (x1[flag1] > 0) {
            if (y1[flag1] > 0) {
              p = x1[flag1] - y1[flag1];
              if (p >= 0) {
                total = total + x1[flag1] - p;
                x1[flag1] = p;
                y1[flag1] = 0;
              } else {
                total = total + y1[flag1] - p * (-1);
                x1[flag1] = 0;
                y1[flag1] = p * (-1);
              }
            }
          }
        } else {
          total = total + y1[flag2] + p;
          x1[flag1] = 0;
          y1[flag2] = p * (-1);
        }
      } else if (x1[flag1] > 0) {
        if (y1[flag1] > 0) {
          p = x1[flag1] - y1[flag1];
          if (p >= 0) {
            total = total + x1[flag1] - p;
            x1[flag1] = p;
            y1[flag1] = 0;
          } else {
            total = total + y1[flag1] - p * (-1);
            x1[flag1] = 0;
            y1[flag1] = p * (-1);
          }
        }
      }
      cout << endl;
    }
    result[i] = total;
  }
  int max = 0;
  for (int i = 0; i < 3; i++) {
    if (result[i] > max) max = result[i];
  }
  cout << num - max << " " << sum[1] + sum[2] + sum[0];
  return 0;
}
