A little boy Laurenty has been playing his favourite game Nota for quite a while and is now very hungry. The boy wants to make sausage and cheese sandwiches, but first, he needs to buy a sausage and some cheese.

The town where Laurenty lives in is not large. The houses in it are located in two rows, n houses in each row. Laurenty lives in the very last house of the second row. The only shop in town is placed in the first house of the first row.

The first and second rows are separated with the main avenue of the city. The adjacent houses of one row are separated by streets.

Each crosswalk of a street or an avenue has some traffic lights. In order to cross the street, you need to press a button on the traffic light, wait for a while for the green light and cross the street. Different traffic lights can have different waiting time.

The traffic light on the crosswalk from the j-th house of the i-th row to the (j + 1)-th house of the same row has waiting time equal to a_{ij} (1 ≤ i ≤ 2, 1 ≤ j ≤ n - 1). For the traffic light on the crossing from the j-th house of one row to the j-th house of another row the waiting time equals b_{j} (1 ≤ j ≤ n). The city doesn't have any other crossings.

The boy wants to get to the store, buy the products and go back. The main avenue of the city is wide enough, so the boy wants to cross it exactly once on the way to the store and exactly once on the way back home. The boy would get bored if he had to walk the same way again, so he wants the way home to be different from the way to the store in at least one crossing. [Image] Figure to the first sample. 

Help Laurenty determine the minimum total time he needs to wait at the crossroads.


-----Input-----

The first line of the input contains integer n (2 ≤ n ≤ 50) — the number of houses in each row. 

Each of the next two lines contains n - 1 space-separated integer — values a_{ij} (1 ≤ a_{ij} ≤ 100). 

The last line contains n space-separated integers b_{j} (1 ≤ b_{j} ≤ 100).


-----Output-----

Print a single integer — the least total time Laurenty needs to wait at the crossroads, given that he crosses the avenue only once both on his way to the store and on his way back home.


-----Examples-----
Input
4
1 2 3
3 2 1
3 2 2 3

Output
12

Input
3
1 2
3 3
2 1 3

Output
11

Input
2
1
1
1 1

Output
4



-----Note-----

The first sample is shown on the figure above. 

In the second sample, Laurenty's path can look as follows:   Laurenty crosses the avenue, the waiting time is 3;  Laurenty uses the second crossing in the first row, the waiting time is 2;  Laurenty uses the first crossing in the first row, the waiting time is 1;  Laurenty uses the first crossing in the first row, the waiting time is 1;  Laurenty crosses the avenue, the waiting time is 1;  Laurenty uses the second crossing in the second row, the waiting time is 3.  In total we get that the answer equals 11.

In the last sample Laurenty visits all the crossings, so the answer is 4.

Difficulty: interview

Starter code:

Solutions:
n = int(input())
a = [[], []]
a[0] = list(map(int, input().split()))
a[1] = list(map(int, input().split()))
b = list(map(int, input().split()))
ans = float('+inf')
for i in range(n):
	for j in range(n):
		if i == j:
			continue
		cur = sum(a[1][i:]) + sum(a[0][:i]) + sum(a[0][:j]) +  sum(a[1][j:]) + b[i] + b[j]
		ans = min(ans, cur)
print(ans)


n = int(input())
a1 = [int(v) for v in input().split()]
a2 = [int(v) for v in input().split()]
b = [int(v) for v in input().split()]

def make_prefixes(a):
	pref = [0, a[0]]
	for v in a[1:]:
		pref.append(pref[-1] + v)
	return pref

prefa1 = make_prefixes(a1)
prefa2 = make_prefixes(a2)

crosstimes = [prefa1[i] + b[i] + (prefa2[-1] - prefa2[i]) for i in range(n)]
crosstimes.sort()

print(crosstimes[0] + crosstimes[1])

n = int(input())
a1 = list(map(int, input().split()))
a2 = list(map(int, input().split()))
b = list(map(int, input().split()))
ans = None
topBottom = sum(a2)
for i in range(n):
    bottomTop = sum(a2)
    for j in range(n):
        if j != i:
            cur = topBottom + b[i] + bottomTop + b[j]
            ans = cur if ans == None else min(ans, cur)
        if (j < n - 1):
            bottomTop = bottomTop + a1[j] - a2[j]
    if i < n - 1:
        topBottom = topBottom + a1[i] - a2[i]
print(ans)


n = int(input())
mas1=list(map(int,input().split(" ")))
mas2=list(map(int,input().split(" ")))
mas3=list(map(int,input().split(" ")))
sum1=0
sum2=sum(mas2)
res=list()
for i in range(n):
    res.append(sum1+sum2+mas3[i])
    if i<n-1:
        sum2-=mas2[i]
        sum1+=mas1[i]
res.sort()
print(res[0]+res[1])

#!/usr/bin/env python3
# -*- coding: utf-8 -*-

N = int(input())

A1s = list(map(int,input().split()))
A2s = list(map(int,input().split()))
Bs = list(map(int,input().split()))

scores = []
score = 0
for n in range(N):
    if n == 0:
        score = Bs[0] + sum(A2s)
    else:
        score -= Bs[n-1]
        score += Bs[n]
        score -= A2s[n-1]
        score += A1s[n-1]
    scores.append(score)
scores.sort()
print(sum(scores[:2]))



n=int(input())
a=list(map(int,input().split(' ')))
b=list(map(int,input().split(' ')))
cr=list(map(int,input().split(' ')))
val=[]
for i in range(n):
    val.append(sum(a[0:i])+cr[i]+sum(b[i::]))
val.sort()
print(val[0]+val[1])

import sys
read = lambda: list(map(int, sys.stdin.readline().split()))
n, = read()
a0s = read()
a1s = read()
bs = read()
best = 10**8
for i in range(n):
   for j in range(i+1, n):
      res = sum(a0s[:i]) + sum(a0s[:j]) \
            + bs[i] + bs[j] \
            + sum(a1s[i:]) + sum(a1s[j:])
      #print(i, j, res)
      if res < best:
         best = res

print(best)



n = int(input())
a1 = [int(i) for i in input().split(" ")]
a2 = [int(i) for i in input().split(" ")]
b = [int(i) for i in input().split(" ")]

res = 1111111111111;
for i in range(0, n):
	for j in range (i+1, n):
		# print(i, j)
		tmp = b[i] + b[j] + sum(a1[:i]) + sum(a2[i:]) + sum(a1[:j]) + sum(a2[j:]);
		if (tmp < res):
			res = tmp;
print(res)

n = int(input())
a1 = [int(x) for x in input().split()]
a2 = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]


best, best_cross = float('inf'), -1

for i in range(n):
	tmp = sum(a1[:i]) + sum(a2[i:]) + b[i]

	if tmp < best:
		best = tmp
		best_cross = i

best2 = float('inf')
for i in range(n):
	if i == best_cross: continue

	tmp = sum(a1[:i]) + sum(a2[i:]) + b[i]

	if tmp < best2:
		best2 = tmp

print(best + best2)


def read_numbers():
    return list(map(int, input().split()))


def f(n, a1, a2, b):
    ways = [sum(a1[:h]) + b[h] + sum(a2[h:]) for h in range(n)]
    ways.sort()
    return sum(ways[:2])


def __starting_point():
    n = int(input())
    a1 = read_numbers()
    a2 = read_numbers()
    b = read_numbers()
    print(f(n, a1, a2, b))

__starting_point()

n = int(input())
a = []
for _ in range(2):
    a.append(list(map(int, input().split())))

b = list(map(int, input().split()))

ans = []
for i, e in enumerate(b):
    ans.append(e + sum(a[0][:i]) + sum(a[1][i:]))

print(sum(sorted(ans)[0:2]))


#!/usr/bin/env python

from sys import stdin

n = int(stdin.readline())
a1 = [int(x) for x in stdin.readline().split()]
a2 = [int(x) for x in stdin.readline().split()]
b = [int(x) for x in stdin.readline().split()]

cum1 = a1[:]
cum2 = a2[:]
for i in range(1, n - 1):
    cum1[i] += cum1[i-1]
for i in range(n - 3, -1, -1):
    cum2[i] += cum2[i+1]

min1, min2 = 1000000, 1000000
for i in range(n):
    c = b[i]
    if i:
        c += cum1[i-1]
    if i < n-1:
        c += cum2[i]

    if c <= min1:
        min2 = min1
        min1 = c
    elif c < min2:
        min2 = c

print(min1 + min2)

n = int(input())
a1 = list(map(int, input().split()))
a2 = list(map(int, input().split()))
b = list(map(int, input().split()))
c = []
k = 0
for i in range(2):
    c.append([0] * n)
c[1][0] = b[0]
for i in range(1, n):
    c[0][i] = c[0][i - 1] + a1[i - 1]
    if c[1][i - 1] + a2[i - 1] > c[0][i] + b[i]:
        k = i
    c[1][i] = min(c[1][i - 1] + a2[i - 1], c[0][i] + b[i])
ans = 0
ans += c[-1][-1]
b[k] = 1000
c = []
for i in range(2):
    c.append([0] * n)
c[1][0] = b[0]
for i in range(1, n):
    c[0][i] = c[0][i - 1] + a1[i - 1]
    c[1][i] = min(c[1][i - 1] + a2[i - 1], c[0][i] + b[i])
ans += c[-1][-1]
print(ans)


n = int(input())
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
s = [int(x) for x in input().split()]
p1 = [0]
for i in range(n - 1):
    p1.append(p1[-1] + a[i])
p2 = [0]
for i in range(n - 1):
    p2.append(p2[-1] + b[-i - 1])
min1 = 10000000
min2 = 10000000
for i in range(n):
    summ = p1[i] + p2[n - i - 1] + s[i]
    if summ < min1:
        min2 = min1
        min1 = summ
    elif summ < min2:
        min2 = summ
print(min1 + min2)

n = int(input())
top = [0]
bot = [0]
top += [int(i) for i in input().split()]
bot += [int(i) for i in input().split()]
cross = [int(i) for i in input().split()]

for i in range(1,n):
    top[i] += top[i-1]
    bot[i] += bot[i-1]

best = 11111111111111;
best2 = 11111111111111;

for i in range(n):
    dist = top[i] + cross[i] + (bot[n-1] - bot[i])
    if dist < best2:
        if dist <= best:
            best2 = best
            best = dist
        else:
            best2 = dist

print(best+best2)


n=int(input())
f=[0]+list(map(int,input().split()))
s=list(map(int,input().split()))+[0]
a=list(map(int,input().split()))
l=sorted([sum(f[:i+1])+a[i]+sum(s[i:]) for i in range(n)])
print(l[0]+l[1])


N=int(input())
A=list(map(int, input().split()))
B=list(map(int, input().split()))
C=list(map(int, input().split()))
cost = [[0],[0]]
for i in range(N-1):
    cost[0].append(cost[0][i]+A[i])
    cost[1].append(cost[1][i]+B[N-2-i])
cost[1].reverse()
min_cost = 99999999999
min_i=-1
for i in range(N):
    if min_cost > cost[0][i]+cost[1][i]+C[i]:
        min_cost = cost[0][i]+cost[1][i]+C[i]
        min_i = i
min_cost2 = 99999999999
for i in range(N):
    if min_cost2 > cost[0][i]+cost[1][i]+C[i] and i!=min_i:
        min_cost2 = cost[0][i]+cost[1][i]+C[i]

print(min_cost+min_cost2)


n = int(input())
row1 = list(map(int, input().split()))
row2 = list(map(int, input().split()))
vert = list(map(int, input().split()))
lo = float('inf')
res = 0
firstcross = 0
secondcross = 0
for i in range(n):
    #print("i", i)
    cur = vert[i]
    cur += sum(row2[i:])
    cur += sum(row1[:i])
    #print(cur)
    if cur < lo:
        firstcross = i
        lo = cur
#print("cross", firstcross)
res += lo
lo = float('inf')
for i in range(n):
    #print("i", i)
    cur = vert[i]
    for j in range(i):
        #print("j row1", j)
        cur += row1[j]
    for j in range(i, n-1):
        #print("j row2", j)
        cur += row2[j]
    #print(cur)
    if cur < lo and i != firstcross:
        lo = cur
        secondcross = i
#print("cross", secondcross)
        
res += lo
print(res)
        


n = int(input())
a1 = list(map(int, input().split()))
a2 = list(map(int, input().split()))
b = list(map(int, input().split()))

pref1 = [0] * n
for i in range(1, n):
    pref1[i] = pref1[i - 1] + a1[i - 1]
pref2 = [0] * n
for i in range(1, n):
    pref2[i] = pref2[i - 1] + a2[i - 1]
post2 = [sum(a2)] * n
for i in range(n):
    post2[i] -= pref2[i]

minimum = -1
for i in range(n):
    for j in range(n):
        if j != i:
            if minimum == -1:
                minimum = pref1[i] + post2[i] + b[i] + pref1[j] + post2[j] + b[j]
            else:
                minimum = min(pref1[i] + post2[i] + b[i] + pref1[j] + post2[j] + b[j], minimum)
print(minimum)


n = int(input())
H1 = list(map(int, input().split()))
H2 = list(map(int, input().split()))
av = list(map(int, input().split()))
ans = []
for i in range(n - 1):
    ans.append(sum(H1[:i]) + av[i] + sum(H2[i:]))
ans.append(sum(H1) + av[-1])
ans.sort()
print(ans[0] + ans[1])


n = int(input())

shop_row = [0] + list(map(int, input().split()))
house_row = list(map(int, input().split())) + [0]
perek = list(map(int, input().split()))

for i in range(len(house_row) - 2, -1, -1):
    house_row[i] += house_row[i + 1]
for i in range(1, len(shop_row)):
    shop_row[i] += shop_row[i - 1]
rez = [None] * n
for i in range(n):
    rez[i] = house_row[i] + shop_row[i] + perek[i]
rez.sort()

if len(rez) > 1:
    print(rez[0] + rez[1])
else:
    print(rez[0] + rez[0])





n = int(input())
a1 = list(map(int, input().split(' ')[:n-1]))
a2 = list(map(int, input().split(' ')[:n-1]))
b = list(map(int, input().split(' ')[:n]))

x1 = 0
x2 = b[0]
cross = 0

for i in range(1, n):
    x1 = x1 + a1[i-1]
    cross_way = x1 + b[i]
    pass_way = x2 + a2[i-1]
    if cross_way < pass_way:
        cross = i
        x2 = cross_way
    else:
        x2 = pass_way

b[cross] = float("inf")
w1 = x2

x1 = 0
x2 = b[0]

for i in range(1, n):
    x1 = x1 + a1[i-1]
    cross_way = x1 + b[i]
    pass_way = x2 + a2[i-1]
    x2 = min(cross_way, pass_way)

print(w1 + x2)


__author__ = 'Om Kumar Sahoo'
n=int(input())
first=[0]+[int(x) for x in input().split()]
second=[int(x) for x in input().split()]+[0]
st=[int(x) for x in input().split()]
firsts=[0]*n
seconds=[0]*n
for i in range(1,n):
    firsts[i]=firsts[i-1]+first[i]
for i in range(n-2,-1,-1):
    seconds[i]=seconds[i+1]+second[i]
time=[0]*n
for i in range(n):
    time[i]=firsts[i]+seconds[i]+st[i]
m1=min(time)
time.remove(m1)
m2=min(time)
print(m1+m2)

n = int(input())
up = [int(item)  for item in input().split()]
down = [int(item)  for item in input().split()]
j = [int(item)  for item in input().split()]
time = 0
mas = []
for idx in range(n - 1, -1, -1):
    mas.append(j[idx] + sum([n for n in up[0:idx]]) + sum([n for n in down[idx:]]))
mas.sort()
print(mas[0] + mas[1])

N=int(input())
x=[[0]*N,[0]*N]
a=list(map(int,input().split()))
adash=[0]
for i in range(N-1):
    adash.append(adash[-1]+a[i])
b=list(map(int,input().split()))
bdash=[0]
for i in range(N-1):
    bdash.append(bdash[-1]+b[i])
c=list(map(int,input().split()))
kachra=[]
for i in range(N):
    kachra.append(adash[i]+c[i]+bdash[-1]-bdash[i])
kachra.sort()
print(kachra[0]+kachra[1])