#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll llinf = (1ll << 61) - 1;
const char lf = '\n', splf[] = " \n";
const int inf = 1000000007, mxn = 100005;
int TC = 1, CN, n, a[3][mxn];
ll dp[3][mxn];
ll sum(int c, int r1, int r2) {
  if (r1 > r2) swap(r1, r2);
  ll ret = 0;
  for (int i = r1; i <= r2; ++i) ret += a[i][c];
  return ret;
}
signed main() {
  cin.tie(0)->sync_with_stdio(0);
  cin.exceptions(cin.failbit);
  cout.precision(11), cout.setf(ios::fixed);
  auto kase = [&]() -> void {
    cin >> n;
    for (int i = 0; i < 3; ++i) {
      for (int j = 0; j < n; ++j) cin >> a[i][j];
    }
    dp[2][n - 1] = a[2][n - 1], dp[1][n - 1] = a[1][n - 1] + dp[2][n - 1],
              dp[0][n - 1] = a[0][n - 1] + dp[1][n - 1];
    for (int j = n - 2; j >= 0; --j) {
      for (int i = 0; i < 3; ++i) {
        ll &ret = dp[i][j];
        ret = -llinf;
        for (int k = 0; k < 3; ++k) {
          ret = max(ret, sum(j, i, k) + dp[k][j + 1]);
        }
        if (i != 1) {
          int k = 2 ^ i;
          ret = max(ret, sum(j, 0, 2) + sum(j + 1, 0, 2) + dp[k][j + 2]);
        }
      }
    }
    cout << dp[0][0] << lf;
  };
  while (CN++ != TC) kase();
}
