#include <bits/stdc++.h>
using namespace std;
int m;
long long dp[3][100010][3][2];
bool vis[3][100010][3][2];
long long ar[3][100010];
long long fun(int r, int c, int dr, int lf) {
  if (c == m) {
    if (r == 2)
      return 0;
    else
      return -1ll << 61;
  }
  if (r < 0 || r >= 3 || c < 0 || c >= m) return -1ll << 61;
  bool &v = vis[r][c][dr][lf];
  long long &ret = dp[r][c][dr][lf];
  if (v) return ret;
  v = 1;
  ret = -1ll << 61;
  if (r == 0) {
    if (dr == 0) {
      ret = max(ret, ar[r][c] + fun(r, c + 1, 0, 1));
      ret = max(ret, ar[r][c] + fun(r + 1, c, 1, lf));
    } else if (dr == 2)
      ret = max(ret, ar[r][c] + fun(r, c + 1, 0, 0));
  } else if (r == 2) {
    if (dr == 0) {
      ret = max(ret, ar[r][c] + fun(r, c + 1, 0, 1));
      ret = max(ret, ar[r][c] + fun(r - 1, c, 2, lf));
    } else if (dr == 1)
      ret = max(ret, ar[r][c] + fun(r, c + 1, 0, 0));
  } else {
    if (dr == 0) {
      ret = max(ret, ar[r][c] + fun(r, c + 1, 0, 0));
      ret = max(ret, ar[r][c] + fun(r - 1, c, 2, 0));
      ret = max(ret, ar[r][c] + fun(r + 1, c, 1, 0));
    } else if (dr == 1) {
      ret = max(ret, ar[r][c] + fun(r + 1, c, 1, 0));
      ret = max(ret, ar[r][c] + fun(r, c + 1, 0, 0));
      if (lf)
        ret = max(ret, ar[r][c] + ar[r][c - 1] + ar[r + 1][c - 1] +
                           ar[r + 1][c] + fun(r + 1, c + 1, 0, 0));
    } else {
      ret = max(ret, ar[r][c] + fun(r - 1, c, 2, 0));
      ret = max(ret, ar[r][c] + fun(r, c + 1, 0, 0));
      if (lf)
        ret = max(ret, ar[r][c] + ar[r][c - 1] + ar[r - 1][c - 1] +
                           ar[r - 1][c] + fun(r - 1, c + 1, 0, 0));
    }
  }
  return ret;
}
int main() {
  scanf("%d", &m);
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < m; j++) scanf("%lld", &ar[i][j]);
  }
  memset(dp, -1, sizeof(dp));
  printf("%lld\n", fun(0, 0, 0, 0));
  return 0;
}
