#include <bits/stdc++.h>
using namespace std;
long long a[3][100005];
long long b[3][100005];
int main() {
  long long size;
  scanf("%lld", &size);
  for (int i = 0; i < 3; ++i) {
    for (long long j = 0; j < size; ++j) {
      scanf("%lld", &a[i][j]);
    }
  }
  long long i = size - 1;
  b[2][i] = a[2][i];
  b[1][i] = a[1][i] + a[2][i];
  b[0][i] = b[1][i] + a[0][i];
  for (i--; i >= 0; --i) {
    b[0][i] = a[0][i] + max(max(max(b[0][i + 1], a[1][i] + b[1][i + 1]),
                                a[1][i] + a[2][i] + b[2][i + 1]),
                            a[0][i + 1] + a[1][i + 1] + a[1][i] + a[2][i] +
                                a[2][i + 1] + b[2][i + 2]);
    b[1][i] = a[1][i] + max(max(b[1][i + 1], a[0][i] + b[0][i + 1]),
                            a[2][i] + b[2][i + 1]);
    b[2][i] = a[2][i] + max(max(max(b[2][i + 1], a[1][i] + b[1][i + 1]),
                                a[1][i] + a[0][i] + b[0][i + 1]),
                            a[2][i + 1] + a[1][i + 1] + a[1][i] + a[0][i] +
                                a[0][i + 1] + b[0][i + 2]);
  }
  printf("%lld\n", b[0][0]);
  return 0;
}
