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