#include<cstdio>
#include<iostream>
#include<algorithm>
#include<string>
#include<cstring>
#include<vector>
#include<stack>
#include<queue>
#include<deque>
#include<map>
#include<set>
#include<limits>
#include<climits>
#include<cmath>
#include<functional>
#include<ctime>
#include<cstdlib>
#include<fstream>
#include<typeinfo>
using namespace std;
typedef long long int ll;
typedef short int i16;
typedef unsigned long long int u64;
typedef unsigned int u32;
typedef unsigned short int u16;
typedef unsigned char u8;
const int N = 150100;
const int N3 = N*3;
const int INF = 1000000000;
struct edge
{
int to,w;
edge(){}
edge(int a, int b)
{
to=a;
w=b;
}
};
struct el
{
int vertex,cost;
el(){}
el(int a, int b)
{
vertex=a;
cost=b;
}
bool operator<(const el &a) const
{
return cost>a.cost;
}
};
int a[4][N];
int n;
vector <edge> v[N3];
int dist[N3];
priority_queue <el> q;
void input() //Correct!
{
scanf("%d", &n);
int i,j;
for(i=1;i<=3;i++)
{
for(j=1;j<=n;j++)
{
scanf("%d", &a[i][j]);
}
}
}
void swap_rows(int r1, int r2) //Correct!
{
int i;
for(i=1;i<=n;i++)
{
swap(a[r1][i],a[r2][i]);
}
}
void build_graph()
{
int i,j;
for(i=0;i<N3;i++)
v[i].clear();
v[0].push_back(edge(1,a[1][1]));
for(i=1;i<n;i++)
{
v[i].push_back(edge(i+1,a[1][i+1]));
v[i].push_back(edge(n+i+1,a[2][i+1]));
}
for(i=1;i<n;i++)
{
v[i+n].push_back(edge(i+n+1,a[2][i+1]));
v[i+n].push_back(edge(i+n*2+1,a[3][i+1]));
}
for(i=1;i<n;i++)
{
v[i+n*2].push_back(edge(i+n*2+1,a[3][i+1]));
}
}
int Dijkstra()
{
int i;
for(i=1;i<N3;i++)
{
dist[i]=INF;
}
dist[0]=0;
q.push(el(0,0));
el curr;
int current_distance;
while(!q.empty())
{
curr=q.top();
q.pop();
for(i=0;i<v[curr.vertex].size();i++)
{
current_distance=v[curr.vertex][i].w+curr.cost;
if(current_distance<dist[v[curr.vertex][i].to])
{
dist[v[curr.vertex][i].to]=current_distance;
q.push(el(v[curr.vertex][i].to,current_distance));
}
}
}
return dist[n*3];
}
void solve()
{
int ans=INF;
build_graph();
ans=min(ans,Dijkstra());
swap_rows(2,3);
build_graph();
ans=min(ans,Dijkstra());
swap_rows(2,3);
swap_rows(1,2);
build_graph();
ans=min(ans,Dijkstra());
swap_rows(2,3);
build_graph();
ans=min(ans,Dijkstra());
swap_rows(2,3);
swap_rows(1,2);
swap_rows(1,3);
build_graph();
ans=min(ans,Dijkstra());
swap_rows(2,3);
build_graph();
ans=min(ans,Dijkstra());
swap_rows(2,3);
swap_rows(1,3);
printf("%d\n", ans);
}
int main()
{
input();
solve();
return 0;
}
I2luY2x1ZGU8Y3N0ZGlvPgojaW5jbHVkZTxpb3N0cmVhbT4KI2luY2x1ZGU8YWxnb3JpdGhtPgojaW5jbHVkZTxzdHJpbmc+CiNpbmNsdWRlPGNzdHJpbmc+CiNpbmNsdWRlPHZlY3Rvcj4KI2luY2x1ZGU8c3RhY2s+CiNpbmNsdWRlPHF1ZXVlPgojaW5jbHVkZTxkZXF1ZT4KI2luY2x1ZGU8bWFwPgojaW5jbHVkZTxzZXQ+CiNpbmNsdWRlPGxpbWl0cz4KI2luY2x1ZGU8Y2xpbWl0cz4KI2luY2x1ZGU8Y21hdGg+CiNpbmNsdWRlPGZ1bmN0aW9uYWw+CiNpbmNsdWRlPGN0aW1lPgojaW5jbHVkZTxjc3RkbGliPgojaW5jbHVkZTxmc3RyZWFtPgojaW5jbHVkZTx0eXBlaW5mbz4KCnVzaW5nIG5hbWVzcGFjZSBzdGQ7Cgp0eXBlZGVmIGxvbmcgbG9uZyBpbnQgbGw7CnR5cGVkZWYgc2hvcnQgaW50IGkxNjsKdHlwZWRlZiB1bnNpZ25lZCBsb25nIGxvbmcgaW50IHU2NDsKdHlwZWRlZiB1bnNpZ25lZCBpbnQgdTMyOwp0eXBlZGVmIHVuc2lnbmVkIHNob3J0IGludCB1MTY7CnR5cGVkZWYgdW5zaWduZWQgY2hhciB1ODsKC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zBdLnB1c2hfYmFjayhlZGdlKDEsYVsxXVsxXSkpOwogICAgZm9yKGk9MTtpPG47aSsrKQogICAgewogICAgICAgIHZbaV0ucHVzaF9iYWNrKGVkZ2UoaSsxLGFbMV1baSsxXSkpOwogICAgICAgIHZbaV0ucHVzaF9iYWNrKGVkZ2UobitpKzEsYVsyXVtpKzFdKSk7CiAgICB9CiAgICBmb3IoaT0xO2k8bjtpKyspCiAgICB7CiAgICAgICAgdltpK25dLnB1c2hfYmFjayhlZGdlKGkrbisxLGFbMl1baSsxXSkpOwogICAgICAgIHZbaStuXS5wdXNoX2JhY2soZWRnZShpK24qMisxLGFbM11baSsxXSkpOwogICAgfQogICAgZm9yKGk9MTtpPG47aSsrKQogICAgewogICAgICAgIHZbaStuKjJdLnB1c2hfYmFjayhlZGdlKGkrbioyKzEsYVszXVtpKzFdKSk7CiAgICB9Cn0KCmludCBEaWprc3RyYSgpCnsKICAgIGludCBpOwogICAgZm9yKGk9MTtpPE4zO2krKykKICAgIHsKICAgICAgICBkaXN0W2ldPUlORjsKICAgIH0KICAgIGRpc3RbMF09MDsKICAgIHEucHVzaChlbCgwLDApKTsKICAgIGVsIGN1cnI7CiAgICBpbnQgY3VycmVudF9kaXN0YW5jZTsKICAgIHdoaWxlKCFxLmVtcHR5KCkpCiAgICB7CiAgICAgICAgY3Vycj1xLnRvcCgpOwogICAgICAgIHEucG9wKCk7CiAgICAgICAgZm9yKGk9MDtpPHZbY3Vyci52ZXJ0ZXhdLnNpemUoKTtpKyspCiAgICAgICAgewogICAgICAgICAgICBjdXJyZW50X2Rpc3RhbmNlPXZbY3Vyci52ZXJ0ZXhdW2ldLncrY3Vyci5jb3N0OwogICAgICAgICAgICBpZihjdXJyZW50X2Rpc3RhbmNlPGRpc3RbdltjdXJyLnZlcnRleF1baV0udG9dKQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBkaXN0W3ZbY3Vyci52ZXJ0ZXhdW2ldLnRvXT1jdXJyZW50X2Rpc3RhbmN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