#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
long long A[N][3], f[N][3], g[N][3];
int main() {
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  for (int j = 0; j < int(3); j++)
    for (int i = 0; i < int(n); i++) cin >> A[i][j];
  f[0][0] = A[0][0];
  f[0][1] = A[0][0] + A[0][1];
  g[0][2] = A[0][0] + A[0][1] + A[0][2];
  g[0][0] = f[0][2] = (long long)-1e15;
  for (int i = 1; i < int(n); i++) {
    f[i][0] =
        max(max(f[i - 1][0], g[i - 1][0]), f[i - 1][1] + A[i][1]) + A[i][0];
    f[i][1] = max(f[i - 1][1], max(max(g[i - 1][0], f[i - 1][0]) + A[i][0],
                                   max(g[i - 1][2], f[i - 1][2]) + A[i][2])) +
              A[i][1];
    f[i][2] =
        max(max(f[i - 1][2], g[i - 1][2]), f[i - 1][1] + A[i][1]) + A[i][2];
    g[i][0] = max(max(f[i - 1][2], g[i - 1][2]) + A[i][2] + A[i][1] + A[i][0],
                  g[i - 1][0] + A[i][0] + A[i][1] + A[i][2]);
    g[i][2] = max(max(f[i - 1][0], g[i - 1][0]) + A[i][0] + A[i][1] + A[i][2],
                  g[i - 1][2] + A[i][0] + A[i][1] + A[i][2]);
  }
  cout << max(f[n - 1][2], g[n - 1][2]) << endl;
  return 0;
}
