Efficient Partitioning

아직 제출이 없습니다시간 제한2초메모리 제한512 MB

문제

Let a partition of \[0,N)\[0, N) be an integer sequence S=(s_0,,s_rS = (s\_0, \ldots, s\_r) that satisfies the following three conditions:

  • s_0=0s\_0 = 0,
  • s_r=Ns\_r = N,
  • s_i<s_i+1s\_i < s\_{i + 1} (0i<r0 \le i < r).

That is, for each ii, \[s_i,s_i+1)\[s\_i, s\_i + 1) represents a continuous interval, and \[0,N)\[0, N) is the union of these rr intervals.

Given are three sequences of length NN consisting of integers between 109-10^9 and 10910^9: AA (a_0,,a_N1a\_0, \ldots, a\_{N-1}), BB (b_0,,b_N1b\_0, \ldots, b\_{N-1}), CC (c_0,,c_N1c\_0, \ldots, c\_{N-1}).

Let the score of partition SS be f(S)f(S) defined as follows:

f(S)=\min\_{0 \leq i < r}\left\\{b\_{s\_i}+c\_{s\_{i+1}-1}+\sum\_{s\_i \leq j < s\_{i+1}} a\_j\right\\}

Find the maximum value of ff over all possible partitions SS.

입력

The first line of input contains one integer NN (1N21051 \le N \le 2 \cdot 10^5). The second line contains nn integers: ii-th of them denotes a_ia\_i. The third and fourth lines describe the sequences bb and cc in the same format (109a_i,b_i,c_i109-10^9 \le a\_i, b\_i, c\_i \le 10^9).

출력

Print one integer: the maximum score over all possible partitions.