There are $n$ people standing in line to buy concert tickets, numbered sequentially from $1$ to $n$. Each person needs exactly one ticket, but each person can buy up to two tickets. Therefore, the $i$-th person can ask the person before them, the $(i-1)$-th person, to buy a ticket for them. The time it takes for the $i$-th person to buy a ticket for themselves is $t_i$. If the $i$-th person asks the $(i-1)$-th person to buy a ticket for them, the time to buy both tickets is $r_i$.
Determine the minimum time required to sell tickets to all $n$ people.
### Input
- The first line contains an integer $n$.
- The second line contains $n$ integers $t_1, t_2, \ldots, t_n$.
- The third line contains $n-1$ integers $r_2, r_3, \ldots, r_n$.
### Output
- Output a single integer representing the minimum time required to sell tickets to all $n$ people.
### Constraints
- $1 \le n \le 10^5$
- $1 \le t_i, r_i \le 10^4$
### Example
Input:
```
5
2 5 7 8 4
4 9 10 10
```
Output:
```
18
```
Explanation:
- Person $2$ buys tickets for both person $1$ and $2$ which takes $4$ units of time.
- Person $4$ buys tickets for both person $3$ and $4$ which takes $10$ units of time.
- Person $5$ only buys their own ticket which takes $4$ units of time.