For this Question: N+1 towns are going to be attacked by monsters. The i-th town will be attacked by Ai monsters. Saloni has got N of her friends for rescue. The i-th friend has the capability to kill at most Bi monsters. The only constraint is that the i-th friend can kill monsters from town i and i+1 only.
Find the maximum number of monsters the friends can kill.The first line of input contains an integer N.
The next line contains N+1 integers Ai.
The next line contains N integers Bi.

Constraints
1 <= N <= 100000
1 <= Ai, Bi <= 1000000000Output a single integer, the maximum number of monsters that can be killed.Sample Input
2
3 5 2
4 5

Sample Output
9

Explanation
The first friend will kill 2 monsters from town 1 and 2 monsters from town 2.
The second friend will kill 3 monsters from town 2 and 2 monsters from town 3.

Sample Input:
2
100 1 1
1 100

Sample Output:
3, I have written this Solution Code: n = int(input())
a= list(map(int,input().strip().split()))
b= list(map(int,input().strip().split()))
b.insert(0,0)
ans=0
for i in range (1,n+1):
    cnt=b[i]
    if i>0:
        mn = min(cnt,a[i-1])
        cnt-=mn
        ans+=mn
    mn = min(cnt,a[i])
    ans += mn;
    a[i] -= mn;
print(ans), In this Programming Language: Python, Now tell me if this Code is compilable or not?