#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  long long sum = 0, fushu = 1;
  char c = getchar();
  while (!isdigit(c)) {
    if (c == '-') fushu = -fushu;
    c = getchar();
  }
  while (isdigit(c)) {
    sum = sum * 10 + (c ^ 48);
    c = getchar();
  }
  return sum * fushu;
}
long long const maxn = 1e5 + 5;
long long n, a[4][maxn], f[4][maxn];
long long sum1[maxn << 2], sum3[maxn << 2], add1[maxn << 2], add3[maxn << 2];
inline void Add(long long *sum, long long *add, long long k, long long v) {
  sum[k] += v;
  add[k] += v;
}
inline void pushdown(long long *sum, long long *add, long long k) {
  if (add[k] == 0) return;
  Add(sum, add, k << 1, add[k]);
  Add(sum, add, k << 1 | 1, add[k]);
  add[k] = 0;
}
void change(long long *sum, long long *add, long long k, long long l,
            long long r, long long x, long long y, long long v) {
  if (l >= x && r <= y) return Add(sum, add, k, v);
  pushdown(sum, add, k);
  long long mid = (l + r) >> 1;
  if (x <= mid) change(sum, add, k << 1, l, mid, x, y, v);
  if (mid < y) change(sum, add, k << 1 | 1, mid + 1, r, x, y, v);
  sum[k] = max(sum[k << 1], sum[k << 1 | 1]);
}
long long query(long long *sum, long long *add, long long k, long long l,
                long long r, long long x, long long y) {
  if (l >= x && r <= y) return sum[k];
  pushdown(sum, add, k);
  long long mid = (l + r) >> 1, res = -1e17;
  if (x <= mid) res = max(res, query(sum, add, k << 1, l, mid, x, y));
  if (mid < y) res = max(res, query(sum, add, k << 1 | 1, mid + 1, r, x, y));
  return res;
}
signed main() {
  n = read();
  for (long long i = 1; i <= 3; i++)
    for (long long j = 1; j <= n; j++) a[i][j] = read();
  f[1][1] = a[1][1];
  f[2][1] = a[1][1] + a[2][1];
  f[3][1] = a[1][1] + a[2][1] + a[3][1];
  change(sum1, add1, 1, 1, n, 1, 1, f[1][1]);
  change(sum3, add3, 1, 1, n, 1, 1, f[3][1]);
  long long allsum = a[1][1] + a[2][1] + a[3][1];
  for (long long i = 2; i <= n; i++) {
    allsum += a[1][i] + a[2][i] + a[3][i];
    change(sum1, add1, 1, 1, n, 1, i - 1, a[1][i] + a[2][i] + a[3][i]);
    change(sum3, add3, 1, 1, n, 1, i - 1, a[1][i] + a[2][i] + a[3][i]);
    f[1][i] = max(f[1][i - 1] + a[1][i],
                  max(f[2][i - 1] + a[1][i] + a[2][i],
                      f[3][i - 1] + a[1][i] + a[2][i] + a[3][i]));
    if (i > 2) f[1][i] = max(f[1][i], query(sum3, add3, 1, 1, n, 1, i - 2));
    f[3][i] = max(f[3][i - 1] + a[3][i],
                  max(f[2][i - 1] + a[2][i] + a[3][i],
                      f[1][i - 1] + a[1][i] + a[2][i] + a[3][i]));
    if (i > 2) f[3][i] = max(f[3][i], query(sum1, add1, 1, 1, n, 1, i - 2));
    f[3][i] = max(f[3][i], allsum);
    f[2][i] = max(f[2][i - 1] + a[2][i], max(f[1][i - 1] + a[1][i] + a[2][i],
                                             f[3][i - 1] + a[3][i] + a[2][i]));
    change(sum1, add1, 1, 1, n, i, i, f[1][i]);
    change(sum3, add3, 1, 1, n, i, i, f[3][i]);
  }
  cout << f[3][n] << endl;
  return 0;
}
