#include <bits/stdc++.h>
using namespace std;
class TaskD {
 public:
  void solve(istream& in, ostream& out) {
    int n;
    in >> n;
    vector<int64_t> a[3];
    vector<int64_t> dp[3];
    for (int i = 0; i < 3; ++i) {
      a[i].resize(n);
      dp[i].assign(n, -1e18);
      for (int j = 0; j < n; ++j) {
        in >> a[i][j];
      }
    }
    dp[0][0] = a[0][0];
    dp[1][0] = dp[0][0] + a[1][0];
    dp[2][0] = dp[1][0] + a[2][0];
    if (3 < n) {
      int64_t tmp = dp[2][0] + a[2][1] + a[2][2] + a[1][2] + a[1][1] + a[0][1] +
                    a[0][2] + a[0][3];
      dp[0][3] = max(dp[0][3], tmp);
      tmp = dp[0][0] + a[0][1] + a[0][2] + a[1][2] + a[1][1] + a[2][1] +
            a[2][2] + a[2][3];
      dp[2][3] = max(dp[2][3], tmp);
    } else if (n == 3) {
      int64_t tmp =
          dp[0][0] + a[0][1] + a[0][2] + a[1][2] + a[1][1] + a[2][1] + a[2][2];
      dp[2][2] = max(dp[2][2], tmp);
    }
    if (2 < n) {
      int64_t tmp =
          dp[0][0] + a[0][1] + a[1][1] + a[1][0] + a[2][0] + a[2][1] + a[2][2];
      dp[2][2] = max(dp[2][2], tmp);
    } else if (n == 2) {
      int64_t tmp = dp[0][0] + a[0][1] + a[1][1] + a[1][0] + a[2][0] + a[2][1];
      dp[2][1] = max(dp[2][1], tmp);
    }
    for (int j = 1; j < n; ++j) {
      dp[0][j] = max(dp[0][j], dp[0][j - 1] + a[0][j]);
      dp[1][j] = max(dp[1][j], dp[1][j - 1] + a[1][j]);
      dp[2][j] = max(dp[2][j], dp[2][j - 1] + a[2][j]);
      int64_t tmp0 = max(dp[1][j], dp[2][j] + a[1][j]) + a[0][j];
      int64_t tmp1 = max(dp[0][j], dp[2][j]) + a[1][j];
      int64_t tmp2 = max(dp[1][j], dp[0][j] + a[1][j]) + a[2][j];
      dp[0][j] = max(dp[0][j], tmp0);
      dp[1][j] = max(dp[1][j], tmp1);
      dp[2][j] = max(dp[2][j], tmp2);
      if (j + 3 < n) {
        int64_t tmp = dp[2][j] + a[2][j + 1] + a[2][j + 2] + a[1][j + 2] +
                      a[1][j + 1] + a[0][j + 1] + a[0][j + 2] + a[0][j + 3];
        dp[0][j + 3] = max(dp[0][j + 3], tmp);
        tmp = dp[0][j] + a[0][j + 1] + a[0][j + 2] + a[1][j + 2] + a[1][j + 1] +
              a[2][j + 1] + a[2][j + 2] + a[2][j + 3];
        dp[2][j + 3] = max(dp[2][j + 3], tmp);
      } else if (j + 3 == n) {
        int64_t tmp = dp[0][j] + a[0][j + 1] + a[0][j + 2] + a[1][j + 2] +
                      a[1][j + 1] + a[2][j + 1] + a[2][j + 2];
        dp[2][j + 2] = max(dp[2][j + 2], tmp);
      }
    }
    out << dp[2][n - 1] << endl;
  }
};
int main() {
  std::ios::sync_with_stdio(false);
  TaskD solver;
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  solver.solve(in, out);
  return 0;
}
