#include using namespace std; typedef long long ll; #define rep(i, s, n) for (int i = (int)(s); i < (int)(n); i++) #define rrep(i, s, n) for (int i = (int)(n)-1; i >= (int)(s); i--) int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); int n; cin >> n; vector a(3, vector(n)); rep(j,0,3) rep(i,0,n) cin >> a[j][i]; // index, used(0-2), now? vector dp(n+1, vector(3, vector(3,-1e18))); dp[0][0][0] = 0; rep(i,0,n){ rep(j,0,3){ rep(x,0,3-j){ rep(k,0,3){ rep(y,0,k+1){ if (dp[i][j][k] < 0) continue; dp[i+1][j+x][y+x] = max(dp[i+1][j+x][y+x], dp[i][j][k] + a[y+x][i]); } } } } } ll ans = -1e18; rep(i,0,3){ rep(j,0,3){ ans = max(ans, dp[n][i][j]); } } cout << ans << '\n'; }