#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:256000000")
using namespace std;
int t;
void solve();
int n;
vector<vector<long long> > a, dp;
long long inf = 1e18;
int main() {
  t = 1;
  for (int i = 0; i < t; ++i) {
    solve();
  }
}
void solve() {
  cin >> n;
  a.resize(3);
  dp.resize(3);
  for (int i = 0; i < int(3); ++i) dp[i].resize(n + 228);
  for (int i = 0; i < int(3); ++i) a[i].resize(n + 228);
  for (int i = 0; i < int(3); ++i)
    for (int j = 0; j < int(n); ++j) cin >> a[i][j];
  for (int i = 0; i < int(3); ++i)
    for (int j = 0; j < int(n + 228); ++j) dp[i][j] = -inf;
  dp[0][0] = a[0][0];
  dp[1][0] = a[0][0] + a[1][0];
  dp[2][0] = a[0][0] + a[1][0] + a[2][0];
  dp[2][1] =
      max(dp[2][1], a[0][0] + a[1][0] + a[2][0] + a[0][1] + a[1][1] + a[2][1]);
  for (int i = 0; i < n; ++i) {
    dp[0][i + 1] = max(dp[0][i + 1], dp[0][i] + a[0][i + 1]);
    dp[1][i + 1] = max(dp[1][i + 1], dp[0][i] + a[0][i + 1] + a[1][i + 1]);
    dp[2][i + 1] =
        max(dp[2][i + 1], dp[0][i] + a[0][i + 1] + a[1][i + 1] + a[2][i + 1]);
    dp[0][i + 1] = max(dp[0][i + 1], dp[1][i] + a[0][i + 1] + a[1][i + 1]);
    dp[1][i + 1] = max(dp[1][i + 1], dp[1][i] + a[1][i + 1]);
    dp[2][i + 1] = max(dp[2][i + 1], dp[1][i] + a[1][i + 1] + a[2][i + 1]);
    dp[0][i + 1] =
        max(dp[0][i + 1], dp[2][i] + a[0][i + 1] + a[1][i + 1] + a[2][i + 1]);
    dp[1][i + 1] = max(dp[1][i + 1], dp[2][i] + a[1][i + 1] + a[2][i + 1]);
    dp[2][i + 1] = max(dp[2][i + 1], dp[2][i] + a[2][i + 1]);
    dp[0][i + 2] =
        max(dp[0][i + 2], dp[2][i] + a[0][i + 1] + a[1][i + 1] + a[2][i + 1] +
                              a[0][i + 2] + a[1][i + 2] + a[2][i + 2]);
    dp[2][i + 2] =
        max(dp[2][i + 2], dp[0][i] + a[0][i + 1] + a[1][i + 1] + a[2][i + 1] +
                              a[0][i + 2] + a[1][i + 2] + a[2][i + 2]);
  }
  cout << dp[2][n - 1];
}
