#include <bits/stdc++.h>
using namespace std;
const long long inf = 1ll << 60;
int n;
long long a[100100][4], f[100100][4], mx[4], sum[100100];
int main() {
  scanf("%d", &n);
  for (int j = 1; j <= 3; j++) {
    for (int i = 1; i <= n; i++) scanf("%I64d", &a[i][j]);
  }
  for (int i = 1; i <= n; i++)
    sum[i] = sum[i - 1] + a[i][1] + a[i][2] + a[i][3];
  f[n + 1][1] = -inf;
  f[n + 1][2] = -inf;
  f[n + 1][3] = 0;
  mx[1] = sum[n] + f[n + 1][1];
  mx[3] = sum[n] + f[n + 1][3];
  for (int i = n; i >= 1; i--) {
    f[i][1] = a[i][1] + f[i + 1][1];
    f[i][1] = max(f[i][1], a[i][1] + a[i][2] + f[i + 1][2]);
    f[i][1] = max(f[i][1], a[i][1] + a[i][2] + a[i][3] + f[i + 1][3]);
    f[i][1] = max(f[i][1], mx[3] - sum[i - 1]);
    f[i][2] = a[i][2] + f[i + 1][2];
    f[i][2] = max(f[i][2], a[i][2] + a[i][1] + f[i + 1][1]);
    f[i][2] = max(f[i][2], a[i][2] + a[i][3] + f[i + 1][3]);
    f[i][3] = a[i][3] + f[i + 1][3];
    f[i][3] = max(f[i][3], a[i][3] + a[i][2] + f[i + 1][2]);
    f[i][3] = max(f[i][3], a[i][3] + a[i][2] + a[i][1] + f[i + 1][1]);
    f[i][3] = max(f[i][3], mx[1] - sum[i - 1]);
    mx[1] = max(mx[1], sum[i - 1] + f[i][1]);
    mx[3] = max(mx[3], sum[i - 1] + f[i][3]);
  }
  printf("%I64d\n", f[1][1]);
  return 0;
}
