Farm Village

Each house along a road needs one crop unit and can grow up to two; minimize the total growing cost plus cost of carrying crops between neighbors.

Medium6Dynamic programmingGreedyNo attempts yetTime limit2sMemory limit512 MB

Problem

There is a village along a road. The village has NN houses, numbered 1 to NN in order along the road. Each house has a field that can grow up to two units of the crop, and each house needs exactly one unit. The total cost of giving every house one unit of the crop is the sum of the carrying costs and the growing costs.

  • Carrying cost: carrying one unit of the crop between house ii and house i+1i+1 costs did_i. The cost is the same in either direction.
  • Growing cost: growing one unit of the crop in the field of house ii costs gig_i.

Compute the minimum total cost of supplying one unit of the crop to every house.

Input

The input is a single test case in the following format.

N
d1 d2 ... dN-1
g1 g2 ... gN

The first line contains an integer NN (2N200,0002 \le N \le 200{,}000), the number of houses. The second line contains N1N-1 integers separated by spaces. The ii-th integer did_i (1di1091 \le d_i \le 10^9, 1iN11 \le i \le N-1) is the carrying cost between house ii and house i+1i+1. The third line contains NN integers separated by spaces. The ii-th integer gig_i (1gi1091 \le g_i \le 10^9, 1iN1 \le i \le N) is the growing cost of the field of house ii.

Output

Print the minimum cost of supplying one unit of the crop to every house.