#include <bits/stdc++.h>
using namespace std;
int W;
signed long long A[3][101010];
signed long long dp[101010][8];
void solve() {
  int i, j, k, l, r, x, y;
  string s;
  cin >> W;
  for (y = 0; y < (3); y++)
    for (x = 0; x < (W); x++) cin >> A[y][x];
  for (x = 0; x < (W + 2); x++)
    for (y = 0; y < (8); y++) dp[x][y] = -1LL << 60;
  dp[0][1] = 0;
  for (x = 0; x < (W); x++) {
    dp[x + 1][1] = max(dp[x + 1][1], dp[x][1] + A[0][x]);
    dp[x + 1][2] = max(dp[x + 1][2], dp[x][1] + A[0][x] + A[1][x]);
    dp[x + 1][4] = max(dp[x + 1][4], dp[x][1] + A[0][x] + A[1][x] + A[2][x]);
    dp[x + 1][1] = max(dp[x + 1][1], dp[x][2] + A[0][x] + A[1][x]);
    dp[x + 1][2] = max(dp[x + 1][2], dp[x][2] + A[1][x]);
    dp[x + 1][4] = max(dp[x + 1][4], dp[x][2] + A[1][x] + A[2][x]);
    dp[x + 1][1] = max(dp[x + 1][1], dp[x][4] + A[0][x] + A[1][x] + A[2][x]);
    dp[x + 1][2] = max(dp[x + 1][2], dp[x][4] + A[1][x] + A[2][x]);
    dp[x + 1][4] = max(dp[x + 1][4], dp[x][4] + A[2][x]);
    dp[x + 1][1] = max(dp[x + 1][1], dp[x][7] + A[0][x] + A[1][x] + A[2][x]);
    dp[x + 1][4] = max(dp[x + 1][4], dp[x][7] + A[0][x] + A[1][x] + A[2][x]);
    dp[x + 1][7] = max(dp[x + 1][7], dp[x][1] + A[0][x] + A[1][x] + A[2][x]);
    dp[x + 1][7] = max(dp[x + 1][7], dp[x][4] + A[0][x] + A[1][x] + A[2][x]);
  }
  cout << dp[W][4] << endl;
}
int main(int argc, char** argv) {
  string s;
  int i;
  if (argc == 1) ios::sync_with_stdio(false), cin.tie(0);
  for (i = 0; i < (argc - 1); i++) s += argv[i + 1], s += '\n';
  for (i = 0; i < (s.size()); i++) ungetc(s[s.size() - 1 - i], stdin);
  solve();
  return 0;
}
