#include <bits/stdc++.h>
using namespace std;
const long long mod = (long long)1e9 + 7;
const long long maxn = (long long)1e5 + 7;
const long long maxe = (long long)1e6 + 7;
const long long INF = (long long)1e15 + 14;
const double PI = acos(-1);
int dx[4] = {0, 0, 1, -1};
int dy[4] = {-1, 1, 0, 0};
long long dp[maxn][3];
long long a[maxn][3];
int n;
int main() {
  cin >> n;
  for (int i = 0; i < maxn; i++)
    for (int j = 0; j < 3; j++) dp[i][j] = -INF;
  for (int j = 0; j < 3; j++)
    for (int i = 1; i <= n; i++) cin >> a[i][j];
  dp[0][0] = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j < 3; j++) {
      if (dp[i - 1][j] == -INF) continue;
      if (j == 0) {
        long long sum = 0;
        for (int k = 0; k < 3; k++) {
          sum += a[i][k];
          dp[i][k] = max(dp[i][k], dp[i - 1][j] + sum);
        }
        if (i >= n) continue;
        for (int k = 0; k < 3; k++) sum += a[i + 1][k];
        dp[i + 1][2 - j] = max(dp[i + 1][2 - j], dp[i - 1][j] + sum);
      } else if (j == 2) {
        long long sum = 0;
        for (int k = 2; k >= 0; k--) {
          sum += a[i][k];
          dp[i][k] = max(dp[i][k], dp[i - 1][j] + sum);
        }
        if (i >= n) continue;
        for (int k = 0; k < 3; k++) sum += a[i + 1][k];
        dp[i + 1][2 - j] = max(dp[i + 1][2 - j], dp[i - 1][j] + sum);
      } else {
        dp[i][1] = max(dp[i][1], dp[i - 1][j] + a[i][1]);
        dp[i][0] = max(dp[i][0], dp[i - 1][j] + a[i][1] + a[i][0]);
        dp[i][2] = max(dp[i][2], dp[i - 1][j] + a[i][1] + a[i][2]);
      }
    }
  }
  cout << dp[n][2] << endl;
  return 0;
}
