#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
mt19937 gen(chrono::steady_clock::now().time_since_epoch().count());
template <typename... T>
void rd(T&... args) {
  ((cin >> args), ...);
}
template <typename... T>
void wr(T... args) {
  ((cout << args << " "), ...);
  cout << endl;
}
void inline cmax(long long& a, long long b) {
  if (b > a) a = b;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n;
  cin >> n;
  vector<vector<long long>> a(n + 2, vector<long long>(3)),
      dp(n + 2, vector<long long>(3, -1e18));
  for (int j = 0; j < int(3); ++j)
    for (int i = 1; i <= int(n); ++i) cin >> a[i][j];
  dp[0][0] = 0;
  for (int i = 1; i <= n; i++) {
    cmax(dp[i][0], max({dp[i - 1][0], dp[i - 1][1] + a[i][1],
                        dp[i - 1][2] + a[i][1] + a[i][2]}) +
                       a[i][0]);
    cmax(dp[i][1],
         max({dp[i - 1][0] + a[i][0], dp[i - 1][1], dp[i - 1][2] + a[i][2]}) +
             a[i][1]);
    cmax(dp[i][2], max({dp[i - 1][0] + a[i][0] + a[i][1],
                        dp[i - 1][1] + a[i][1], dp[i - 1][2]}) +
                       a[i][2]);
    dp[i + 1][0] =
        max(dp[i + 1][0], dp[i - 1][2] + a[i][0] + a[i][1] + a[i][2] +
                              a[i + 1][0] + a[i + 1][1] + a[i + 1][2]);
    dp[i + 1][2] =
        max(dp[i + 1][2], dp[i - 1][0] + a[i][0] + a[i][1] + a[i][2] +
                              a[i + 1][0] + a[i + 1][1] + a[i + 1][2]);
  }
  cout << dp[n][2];
  return 0;
}
