#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100005;
long long MAN = 1000000000000000;
long long n, a[4][MAXN];
long long dp[MAXN][6];
int main() {
  ios::sync_with_stdio(NULL);
  cin.tie(0);
  cin >> n;
  for (int i = 1; i <= 3; i++)
    for (int j = 1; j <= n; j++) cin >> a[i][j];
  dp[0][3] = 0;
  dp[0][1] = -MAN;
  dp[0][2] = -MAN;
  dp[0][4] = -MAN;
  dp[0][5] = -MAN;
  for (int i = 1; i <= n; i++) {
    dp[i][1] =
        dp[i - 1][5] + a[1][i] + a[2][i] + a[3][i] + a[2][i + 1] + a[3][i + 1];
    dp[i][2] =
        dp[i - 1][3] + a[1][i] + a[2][i] + a[3][i] + a[2][i + 1] + a[1][i + 1];
    dp[i][3] = max(dp[i - 1][1] + a[1][i], dp[i - 1][4] + a[2][i] + a[1][i]);
    dp[i][3] = max(dp[i][3], dp[i - 1][5] + a[3][i] + a[2][i] + a[1][i]);
    dp[i][3] = max(dp[i][3], dp[i - 1][3] + a[1][i]);
    dp[i][4] = max(dp[i - 1][4] + a[2][i], dp[i - 1][3] + a[1][i] + a[2][i]);
    dp[i][4] = max(dp[i][4], dp[i - 1][5] + a[2][i] + a[3][i]);
    dp[i][5] = max(dp[i - 1][2] + a[3][i], dp[i - 1][4] + a[2][i] + a[3][i]);
    dp[i][5] = max(dp[i][5], dp[i - 1][3] + a[1][i] + a[2][i] + a[3][i]);
    dp[i][5] = max(dp[i][5], dp[i - 1][5] + a[3][i]);
  }
  cout << dp[n][5] << "\n";
}
