#include <bits/stdc++.h>
template <typename T>
inline bool chkmin(T &a, const T &b) {
  return a > b ? a = b, 1 : 0;
}
template <typename T>
inline bool chkmax(T &a, const T &b) {
  return a < b ? a = b, 1 : 0;
}
using namespace std;
const int maxn = 100001;
using ll = long long;
const ll inf = 1e18;
ll dp[maxn][3];
ll a[maxn][3];
ll colsum[maxn];
int n;
ll path(int r, int c) {
  if (c > n) return -inf;
  if (c == n) return (r == 2) ? 0 : -inf;
  ll &ret = dp[c][r];
  if (ret != -1) return ret;
  ret = -inf;
  ll coladd = 0;
  for (int i = (r), i_end_ = (3); i < i_end_; ++i) {
    coladd += a[c][i];
    ret = max(ret, path(i, c + 1) + coladd);
  }
  coladd = 0;
  for (int i = r; i >= 0; i--) {
    coladd += a[c][i];
    ret = max(ret, path(i, c + 1) + coladd);
  }
  if (r != 1 && c + 1 < n) {
    ret = max(ret, path(r == 0 ? 2 : 0, c + 2) + colsum[c] + colsum[c + 1]);
  }
  return ret;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  for (int j = (0), j_end_ = (3); j < j_end_; ++j)
    for (int i = (0), i_end_ = (n); i < i_end_; ++i) cin >> a[i][j];
  for (int i = (0), i_end_ = (n); i < i_end_; ++i)
    colsum[i] = a[i][0] + a[i][1] + a[i][2];
  memset(dp, -1, sizeof(dp));
  cout << path(0, 0) << endl;
  return 0;
}
