#include <bits/stdc++.h>
using namespace std;
const int N = 100010;
int n;
long long dp[3][N], grid[3][N];
int main() {
  scanf("%d", &n);
  for (int i = 0; i < 3; i++)
    for (int j = 0; j < n; j++) scanf("%lld", &grid[i][j]);
  dp[2][n - 1] = grid[2][n - 1];
  dp[1][n - 1] = grid[1][n - 1] + dp[2][n - 1];
  dp[0][n - 1] = grid[0][n - 1] + dp[1][n - 1];
  for (int i = n - 2; i >= 0; i--) {
    for (int j = 0; j < 3; j++) {
      if (j == 0) {
        dp[j][i] = grid[j][i] + dp[j][i + 1];
        dp[j][i] =
            max(dp[j][i], grid[j][i] + grid[j + 1][i] + dp[j + 1][i + 1]);
        dp[j][i] = max(dp[j][i], grid[j][i] + grid[j + 1][i] + grid[j + 2][i] +
                                     dp[j + 2][i + 1]);
        if (i == n - 2) {
          dp[j][i] = max(
              dp[j][i],
              grid[j][i] + grid[j + 2][i + 1] +
                  max(max(grid[j + 1][i], grid[j][i + 1]) + grid[j + 1][i + 1],
                      grid[j + 1][i] + grid[j][i + 1] + grid[j + 1][i + 1] +
                          grid[j + 2][i]));
        }
        if (i < n - 2) {
          dp[j][i] =
              max(dp[j][i], dp[j][i + 2] + grid[j][i] + grid[j][i + 1] +
                                max(grid[j + 1][i] + grid[j + 1][i + 1],
                                    grid[j + 1][i] + grid[j + 1][i + 1] +
                                        grid[j + 2][i] + grid[j + 2][i + 1]));
          dp[j][i] =
              max(dp[j][i],
                  dp[j + 1][i + 2] + grid[j][i] + grid[j + 1][i + 1] +
                      max(grid[j + 1][i],
                          max(grid[j][i + 1], grid[j + 1][i] + grid[j + 2][i] +
                                                  grid[j + 2][i + 1])));
          dp[j][i] = max(
              dp[j][i],
              dp[j + 2][i + 2] + grid[j][i] + grid[j + 2][i + 1] +
                  max(max(grid[j + 1][i], grid[j][i + 1]) + grid[j + 1][i + 1],
                      grid[j + 1][i] + grid[j][i + 1] + grid[j + 1][i + 1] +
                          grid[j + 2][i]));
        }
      } else if (j == 1) {
        dp[j][i] = grid[j][i] + dp[j][i + 1];
        dp[j][i] =
            max(dp[j][i], grid[j][i] + grid[j - 1][i] + dp[j - 1][i + 1]);
        dp[j][i] =
            max(dp[j][i], grid[j][i] + grid[j + 1][i] + dp[j + 1][i + 1]);
        if (i == n - 2) {
          dp[j][i] =
              max(dp[j][i],
                  grid[j][i] + grid[j + 1][i + 1] +
                      max(grid[j - 1][i] + grid[j - 1][i + 1] + grid[j][i + 1],
                          max(grid[j][i + 1], grid[j + 1][i])));
        }
        if (i < n - 2) {
          dp[j][i] =
              max(dp[j][i],
                  grid[j][i] + grid[j - 1][i + 1] + dp[j - 1][i + 2] +
                      max(grid[j + 1][i] + grid[j + 1][i + 1] + grid[j][i + 1],
                          max(grid[j][i + 1], grid[j - 1][i])));
          dp[j][i] = max(
              dp[j][i],
              grid[j][i] + grid[j][i + 1] + dp[j][i + 2] +
                  max((long long)0, max(grid[j - 1][i] + grid[j - 1][i + 1],
                                        grid[j + 1][i] + grid[j + 1][i + 1])));
          dp[j][i] =
              max(dp[j][i],
                  grid[j][i] + grid[j + 1][i + 1] + dp[j + 1][i + 2] +
                      max(grid[j - 1][i] + grid[j - 1][i + 1] + grid[j][i + 1],
                          max(grid[j][i + 1], grid[j + 1][i])));
        }
      } else {
        dp[j][i] = grid[j][i] + dp[j][i + 1];
        dp[j][i] =
            max(dp[j][i], grid[j][i] + grid[j - 1][i] + dp[j - 1][i + 1]);
        dp[j][i] = max(dp[j][i], grid[j][i] + grid[j - 1][i] + grid[j - 2][i] +
                                     dp[j - 2][i + 1]);
        if (i < n - 2) {
          dp[j][i] =
              max(dp[j][i], dp[j][i + 2] + grid[j][i] + grid[j][i + 1] +
                                max(grid[j - 1][i] + grid[j - 1][i + 1],
                                    grid[j - 1][i] + grid[j - 1][i + 1] +
                                        grid[j - 2][i] + grid[j - 2][i + 1]));
          dp[j][i] =
              max(dp[j][i],
                  dp[j - 1][i + 2] + grid[j][i] + grid[j - 1][i + 1] +
                      max(grid[j - 1][i],
                          max(grid[j][i + 1], grid[j - 1][i] + grid[j - 2][i] +
                                                  grid[j - 2][i + 1])));
          dp[j][i] = max(
              dp[j][i],
              dp[j - 2][i + 2] + grid[j][i] + grid[j - 2][i + 1] +
                  max(max(grid[j - 1][i], grid[j][i + 1]) + grid[j - 1][i + 1],
                      grid[j - 1][i] + grid[j][i + 1] + grid[j - 1][i + 1] +
                          grid[j - 2][i]));
        }
      }
    }
  }
  cout << dp[0][0] << endl;
  return 0;
}
