#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
inline long long getint() {
  long long _x = 0, _tmp = 1;
  char _tc = getchar();
  while ((_tc < '0' || _tc > '9') && _tc != '-') _tc = getchar();
  if (_tc == '-') _tc = getchar(), _tmp = -1;
  while (_tc >= '0' && _tc <= '9') _x *= 10, _x += (_tc - '0'), _tc = getchar();
  return _x * _tmp;
}
inline long long add(long long _x, long long _y,
                     long long _mod = 1000000007LL) {
  _x += _y;
  return _x >= _mod ? _x - _mod : _x;
}
inline long long sub(long long _x, long long _y,
                     long long _mod = 1000000007LL) {
  _x -= _y;
  return _x < 0 ? _x + _mod : _x;
}
inline long long mul(long long _x, long long _y,
                     long long _mod = 1000000007LL) {
  _x *= _y;
  return _x >= _mod ? _x % _mod : _x;
}
long long mypow(long long _a, long long _x, long long _mod) {
  if (_x == 0) return 1LL;
  long long _ret = mypow(mul(_a, _a, _mod), _x >> 1, _mod);
  if (_x & 1) _ret = mul(_ret, _a, _mod);
  return _ret;
}
long long mymul(long long _a, long long _x, long long _mod) {
  if (_x == 0) return 0LL;
  long long _ret = mymul(add(_a, _a, _mod), _x >> 1, _mod);
  if (_x & 1) _ret = add(_ret, _a, _mod);
  return _ret;
}
inline bool equal(double _x, double _y) {
  return _x > _y - 1e-9 && _x < _y + 1e-9;
}
int __ = 1, _cs;
void build() {}
long long n, a[3][101010], dp[101010][4];
void init() {
  n = getint();
  for (int j = 0; j < 3; j++)
    for (int i = 1; i <= n; i++) a[j][i] = getint();
}
inline long long sum(int col, int fr, int to) {
  if (fr > to) swap(fr, to);
  long long ret = 0;
  for (int i = fr; i <= to; i++) ret += a[i][col];
  return ret;
}
void solve() {
  dp[0][0] = 0;
  dp[0][1] = -10000000000000000LL;
  dp[0][2] = -10000000000000000LL;
  dp[0][3] = -10000000000000000LL;
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j < 4; j++) dp[i][j] = -10000000000000000LL;
    for (int j = 0; j < 3; j++)
      for (int nj = 0; nj < 3; nj++)
        dp[i][nj] = max(dp[i][nj], dp[i - 1][j] + sum(i, j, nj));
    long long al = sum(i, 0, 2);
    for (int j : {0, 2}) {
      dp[i][3] = max(dp[i][3], dp[i - 1][j] + al);
      dp[i][j] = max(dp[i][j], dp[i - 1][3] + al);
    }
  }
  printf("%lld\n", dp[n][2]);
}
int main() {
  build();
  while (__--) {
    init();
    solve();
  }
}
