#include <bits/stdc++.h>
using namespace std;
const int N = 100000 + 10;
const int M = 1000000007;
const double PI = atan(1) * 4;
const int oo = 2100000000;
int n;
long long dp[N][8];
vector<vector<int> > v;
int main() {
  cin >> n;
  v.resize(3);
  memset(dp, -1, sizeof(dp));
  for (int i = 0; i < 3; ++i) {
    v[i].resize(n);
    for (int j = 0; j < n; ++j) scanf("%d", &v[i][j]);
  }
  for (int i = 0; i < 8; ++i) dp[n][i] = -1e17;
  dp[n][0b001] = 0;
  for (int u = n - 1; u >= 0; --u) {
    for (int st = 0; st < 8; ++st) {
      if (st == 0b100)
        dp[u][st] =
            0ll + v[0][u] +
            max(max(dp[u + 1][0b100], v[1][u] + dp[u + 1][0b010]),
                v[1][u] + v[2][u] + max(dp[u + 1][0b111], dp[u + 1][0b001]));
      if (st == 0b010)
        dp[u][st] = 0ll + v[1][u] +
                    max(dp[u + 1][0b010], max(v[0][u] + dp[u + 1][0b100],
                                              v[2][u] + dp[u + 1][0b001]));
      if (st == 0b001)
        dp[u][st] =
            0ll + v[2][u] +
            max(max(dp[u + 1][0b001], v[1][u] + dp[u + 1][0b010]),
                v[0][u] + v[1][u] + max(dp[u + 1][0b111], dp[u + 1][0b100]));
      if (st == 0b111)
        dp[u][st] =
            0ll + v[0][u] + v[1][u] + v[2][u] +
            max(dp[u + 1][0b111], max(dp[u + 1][0b100], dp[u + 1][0b001]));
    }
  }
  cout << dp[0][0b100];
}
