#include <bits/stdc++.h>
using namespace std;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
using ll = long long int;
using ld = long double;
using pi = pair<int, int>;
const double PI = acos(-1.0);
const double eps = 1e-9;
const ll mod = 1e9 + 7;
const ll inf = 1e15;
const int MAXN = 1e5 + 5;
int n;
int arr[3][MAXN];
ll dp[3][MAXN][3];
bool vis[3][MAXN][3];
ll solve(int i, int j, int st) {
  if (j == n) return i == 2 && !st ? 0 : -inf;
  ll &ret = dp[i][j][st];
  if (vis[i][j][st]) return ret;
  vis[i][j][st] = true;
  ret = -inf;
  ll ans = -inf;
  if (st == 0) {
    ll sum = 0;
    for (int k = i; k >= 0; k--) {
      sum += arr[k][j];
      ans = max(ans, sum + solve(k, j + 1, 0));
    }
    sum = 0;
    for (int k = i; k < 3; k++) {
      sum += arr[k][j];
      ans = max(ans, sum + solve(k, j + 1, 0));
    }
    sum = arr[0][j] + arr[1][j] + 0LL + arr[2][j];
    if (i == 0 || i == 2)
      ans = max({ans, sum + solve(0, j + 1, 1), sum + solve(2, j + 1, 1)});
  } else {
    ll sum = arr[0][j] + arr[1][j] + 0LL + arr[2][j];
    ans = max(ans, sum + solve(0, j + 1, 1));
    ans = max(ans, sum + solve(2, j + 1, 1));
    if (st == 1) {
      ans = max(ans, sum + solve(0, j + 1, 0));
      ans = max(ans, sum + solve(2, j + 1, 0));
    }
  }
  return ret = ans;
}
void cp() {
  cin >> n;
  for (int i = 0; i < 3; i++)
    for (int j = 0; j < n; j++) cin >> arr[i][j];
  memset(vis, false, sizeof(vis));
  ;
  cout << solve(0, 0, 0) << '\n';
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  int t;
  t = 1;
  while (t--) {
    cp();
  }
  return 0;
}
