#include <bits/stdc++.h>
using namespace std;
const long long N = 500005;
const long long mod = 1e9 + 7;
void solve() {
  long long x = 0, y = 0, c = 0, ans = 0;
  long long n, m, k;
  cin >> n;
  long long a[3][n], dp[3][n];
  for (long long i = 0; i < 3; ++i) {
    for (long long j = 0; j < n; ++j) {
      cin >> a[i][j];
      dp[i][j] = -1e18;
    }
  }
  dp[0][0] = a[0][0];
  for (long long i = 1; i < n; ++i) {
    dp[0][i] = a[0][i] + max({dp[0][i - 1], dp[1][i - 1] + a[0][i - 1],
                              dp[2][i - 1] + a[1][i - 1] + a[0][i - 1]});
    dp[1][i] = a[1][i] + max({dp[1][i - 1], dp[0][i - 1] + a[1][i - 1],
                              dp[2][i - 1] + a[1][i - 1]});
    dp[2][i] = a[2][i] + max({dp[2][i - 1], dp[1][i - 1] + a[2][i - 1],
                              dp[0][i - 1] + a[1][i - 1] + a[2][i - 1]});
    if (i > 1) {
      dp[0][i] =
          max(dp[0][i], dp[2][i - 2] + a[2][i - 1] + a[1][i - 1] + a[1][i - 2] +
                            a[0][i - 2] + a[0][i - 1] + a[0][i]);
      dp[2][i] =
          max(dp[2][i], dp[0][i - 2] + a[0][i - 1] + a[1][i - 1] + a[1][i - 2] +
                            a[2][i - 2] + a[2][i - 1] + a[2][i]);
    }
  }
  ans = max({dp[2][n - 1], a[2][n - 1] + dp[1][n - 1],
             a[1][n - 1] + a[2][n - 1] + dp[0][n - 1]});
  if (n > 1)
    ans = max({ans, dp[0][n - 2] + a[1][n - 2] + a[2][n - 2] + a[0][n - 1] +
                        a[1][n - 1] + a[2][n - 1]});
  cout << ans << "\n";
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  solve();
  return 0;
}
