#include <bits/stdc++.h>
using namespace std;
const long long INF = 100000000000000000LL;
int main() {
  int n;
  scanf("%d", &n);
  long long a[3][n];
  for (int i = 0; i < 3; ++i) {
    for (int j = 0; j < n; ++j) {
      scanf("%I64d", &a[i][j]);
    }
  }
  long long dp[3][n][1 << 3][1 << 3];
  for (int i = 0; i < 3; ++i) {
    for (int j = 0; j < n; ++j) {
      for (int k = 0; k < 8; ++k) {
        for (int t = 0; t < 8; ++t) {
          dp[i][j][k][t] = i == 0 && j == 0 && t == 0 ? 0 : -INF;
        }
      }
    }
  }
  dp[0][0][0][1] = a[0][0];
  long long res = -INF;
  int colMasks[] = {0, 1, 2, 4, 3, 6, 5, 7};
  for (int col = 0; col < n; ++col) {
    for (int prevCol = 0; prevCol < 8; ++prevCol) {
      for (int currCol = 0; currCol < 8; ++currCol) {
        for (int row = 0; row < 3; ++row) {
          int prevMask = colMasks[prevCol];
          int currMask = colMasks[currCol];
          if ((col == 0 && row == 0) || ((currMask & (1 << row)) == 0)) {
            continue;
          }
          int d[] = {-1, 1};
          for (int k = 0; k < 2; ++k) {
            bool firstValid = row + d[k] >= 0 && row + d[k] < 3;
            bool secondValid = row - d[k] >= 0 && row - d[k] < 3;
            if (firstValid && (currMask & (1 << (row + d[k]))) != 0 &&
                (!secondValid || (currMask & (1 << (row - d[k]))) == 0)) {
              int mul = 1;
              long long toAdd = a[row][col] + a[row + d[k]][col];
              if ((row + 2 * d[k] >= 0) && (row + 2 * d[k] < 3) &&
                  (currMask & (1 << (row + 2 * d[k]))) != 0) {
                toAdd += a[row + 2 * d[k]][col];
                mul++;
              }
              if (col == 0) {
                if (row + mul * d[k] == 0) {
                  dp[row][col][prevCol][currCol] =
                      max(dp[row][col][prevCol][currCol], toAdd);
                }
              } else {
                if ((prevMask & (1 << (row + mul * d[k]))) != 0) {
                  for (int nextPrev = 0; nextPrev < 8; ++nextPrev) {
                    if (dp[row + mul * d[k]][col - 1][nextPrev][prevCol] !=
                        -INF) {
                      dp[row][col][prevCol][currCol] = max(
                          dp[row][col][prevCol][currCol],
                          toAdd +
                              dp[row + mul * d[k]][col - 1][nextPrev][prevCol]);
                    }
                  }
                }
                if ((prevMask & (1 << row)) != 0 &&
                    (prevMask & (1 << (row + d[k]))) != 0) {
                  toAdd =
                      a[row][col] + a[row + d[k]][col - 1] + a[row + d[k]][col];
                  int newCurrMask = prevMask ^ (1 << (row + d[k]));
                  int newCurrIndex = colMasks[newCurrMask];
                  for (int newPrevIndex = 0; newPrevIndex < 8; ++newPrevIndex) {
                    if (dp[row][col - 1][newPrevIndex][newCurrIndex] != -INF) {
                      dp[row][col][prevCol][currCol] = max(
                          dp[row][col][prevCol][currCol],
                          dp[row][col - 1][newPrevIndex][newCurrIndex] + toAdd);
                    }
                  }
                  {
                    int newPrevMask =
                        prevMask ^ (1 << row) ^ (1 << (row + d[k]));
                    int newPrevIndex = colMasks[newPrevMask];
                    int newCurrMask = currMask ^ (1 << row);
                    int newCurrIndex = colMasks[newCurrMask];
                    toAdd =
                        a[row][col] + a[row][col - 1] + a[row + d[k]][col - 1];
                    if (dp[row + d[k]][col][newPrevIndex][newCurrIndex] !=
                        -INF) {
                      dp[row][col][prevCol][currCol] =
                          max(dp[row][col][prevCol][currCol],
                              dp[row + d[k]][col][newPrevIndex][newCurrIndex] +
                                  toAdd);
                    }
                  }
                }
              }
            }
          }
          if (col > 0 && currMask == (1 << row) &&
              (prevMask & (1 << row)) != 0) {
            for (int newPrev = 0; newPrev < 8; ++newPrev) {
              if (dp[row][col - 1][newPrev][prevCol] != -INF &&
                  dp[row][col][prevCol][currCol] <
                      dp[row][col - 1][newPrev][prevCol] + a[row][col]) {
                dp[row][col][prevCol][currCol] =
                    dp[row][col - 1][newPrev][prevCol] + a[row][col];
              }
            }
          }
          if (row == 2 && col == n - 1) {
            res = max(res, dp[row][col][prevCol][currCol]);
          }
        }
      }
    }
  }
  printf("%I64d", res);
  return 0;
}
