#include <bits/stdc++.h>
using namespace std;
const long long PR = 1000000009;
long long n, A[3][100009], dp[3][100009];
int main() {
  ios::sync_with_stdio(false);
  cin >> n;
  for (int i = 0; i < 100009; i++)
    A[0][i] = A[1][i] = A[2][i] = 0,
    dp[0][i] = dp[1][i] = dp[2][i] = -1 * 10000000000000000ll;
  for (int i = 0; i < n; i++) {
    cin >> A[0][i];
  }
  for (int i = 0; i < n; ++i) cin >> A[1][i];
  for (int i = 0; i < n; ++i) cin >> A[2][i];
  dp[2][n] = 0;
  for (int i = n - 1; i >= 0; i--) {
    long long presum = A[0][i];
    dp[0][i] = max(dp[0][i], presum + dp[0][i + 1]);
    dp[2][i] = max(dp[2][i], A[2][i] + dp[2][i + 1]);
    presum += A[1][i];
    dp[0][i] = max(dp[0][i], presum + dp[1][i + 1]);
    dp[2][i] = max(dp[2][i], A[2][i] + A[1][i] + dp[1][i + 1]);
    presum += A[2][i];
    dp[0][i] = max(dp[0][i], presum + dp[2][i + 1]);
    dp[2][i] = max(dp[2][i], presum + dp[0][i + 1]);
    presum += A[0][i + 1] + A[1][i + 1] + A[2][i + 1];
    dp[2][i] = max(dp[2][i], presum + dp[0][i + 2]);
    dp[0][i] = max(dp[0][i], presum + dp[2][i + 2]);
    dp[1][i] = max(dp[1][i], A[1][i] + dp[1][i + 1]);
    dp[1][i] = max(dp[1][i], A[1][i] + A[0][i] + dp[0][i + 1]);
    dp[1][i] = max(dp[1][i], A[1][i] + A[2][i] + dp[2][i + 1]);
  }
  cout << dp[0][0] << '\n';
  return 0;
};
