#include <bits/stdc++.h>
using namespace std;
long long dp[3];
long long fa = 0, fb = 0, fc = 0;
long long dpspec[3];
int mat[100010][4];
long long max(long long a, long long b, long long c) {
  return max(a, max(b, c));
}
int main() {
  dp[2] = dp[1] = dpspec[2] = -1000000000000ll;
  int n;
  scanf("%d", &n);
  for (int i(0); i < 3; i++)
    for (int j(0); j < n; j++) scanf("%d", &mat[j][i]);
  for (int i(0); i < n; i++) {
    long long a, b, c, r1, r2, r3;
    a = mat[i][0], b = mat[i][1], c = mat[i][2];
    r1 = max(dp[0] + a, dp[1] + a + b, dp[2] + a + b + c);
    r1 = max(r1, dpspec[2] + a + b + c + fa + fb);
    r2 = max(dp[0] + a + b, dp[1] + b, dp[2] + b + c);
    r3 = max(dp[0] + a + b + c, dp[1] + b + c, dp[2] + c);
    r3 = max(r3, dpspec[0] + fb + fc + a + b + c);
    dpspec[0] = dp[0] + a, dpspec[2] = dp[2] + c;
    dp[0] = r1, dp[1] = r2, dp[2] = r3;
    fa = a, fb = b, fc = c;
  }
  cout << dp[2];
  return 0;
}
