{"raw_statement":[{"iden":"problem statement","content":"Given is an undirected graph with $N+1$ vertices.  \nThe vertices are called Vertex $0$, Vertex $1$, $\\ldots$, Vertex $N$.\nFor each $i=1,2,\\ldots,N$, the graph has an undirected edge with a weight of $A_i$ connecting Vertex $0$ and Vertex $i$.\nAdditionally, for each $i=1,2,\\ldots,N$, the graph has an undirected edge with a weight of $B_i$ connecting Vertex $i$ and Vertex $i+1$. (Here, Vertex $N+1$ stands for Vertex $1$.)\nThe graph has no edge other than these $2N$ edges above.\nLet us delete some of the edges from this graph so that the graph will be bipartite.  \nWhat is the minimum total weight of the edges that have to be deleted?"},{"iden":"constraints","content":"*   $3 \\leq N \\leq 2 \\times 10^5$\n*   $1 \\leq A_i \\leq 10^9$\n*   $1 \\leq B_i \\leq 10^9$\n*   All values in input are integers."},{"iden":"input","content":"Input is given from Standard Input in the following format:\n\n$N$\n$A_1$ $A_2$ $\\dots$ $A_N$\n$B_1$ $B_2$ $\\dots$ $B_N$"},{"iden":"sample input 1","content":"5\n31 4 159 2 65\n5 5 5 5 10"},{"iden":"sample output 1","content":"16\n\n![image](https://img.atcoder.jp/ghi/ded08d4aa13d31bea28b91afe246c790.png)  \nDeleting the edge connecting Vertices $0,2$ (weight: $4$), the edge connecting Vertices $0,4$ (weight: $2$), and the edge connecting Vertices $1,5$ (weight: $10$) makes the graph bipartite."},{"iden":"sample input 2","content":"4\n100 100 100 1000000000\n1 2 3 4"},{"iden":"sample output 2","content":"10"}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}