# ABC135C - City Savers

# greedy algorithm

def main():

    n = int(eval(input()))

    A = tuple(map(int, input().split()))

    B = tuple(map(int, input().split()))

    ans, a1 = 0, A[0]

    for a2, b in zip(A[1:], B):

        cnt1 = min(a1, b)

        cnt2 = min(a2, b - cnt1)

        ans += cnt1 + cnt2

        a1 = a2 - cnt2  # a2 becomes a1 in next turn

    print(ans)





if __name__ == "__main__":

    main()
# ABC135C - City Savers

# greedy algorithm

def main():

    n = int(eval(input()))

    A = tuple(map(int, input().split()))

    B = tuple(map(int, input().split()))

    ans, a1 = 0, A[0]

    for a2, b in zip(A[1:], B):

        cnt1 = a1 if a1 < b else b

        cnt2 = a2 if a2 < b - cnt1 else b - cnt1

        ans += cnt1 + cnt2

        a1 = a2 - cnt2  # a2 becomes a1 in next turn

    print(ans)





if __name__ == "__main__":

    main()
# ABC135C - City Savers
# greedy algorithm
def main():
    n = int(eval(input()))
    A = tuple(map(int, input().split()))
    B = tuple(map(int, input().split()))
    ans, a1 = 0, A[0]
    for a2, b in zip(A[1:], B):
        cnt1 = min(a1, b)
        cnt2 = min(a2, b - cnt1)
        ans += cnt1 + cnt2
        a1 = a2 - cnt2  # a2 becomes a1 in next turn
    print(ans)


if __name__ == "__main__":
    main()

# ABC135C - City Savers
# greedy algorithm
def main():
    n = int(eval(input()))
    A = tuple(map(int, input().split()))
    B = tuple(map(int, input().split()))
    ans, a1 = 0, A[0]
    for a2, b in zip(A[1:], B):
        cnt1 = a1 if a1 < b else b
        cnt2 = a2 if a2 < b - cnt1 else b - cnt1
        ans += cnt1 + cnt2
        a1 = a2 - cnt2  # a2 becomes a1 in next turn
    print(ans)


if __name__ == "__main__":
    main()

-        cnt1 = min(a1, b) -        cnt2 = min(a2, b - cnt1) +        cnt1 = a1 if a1 < b else b +        cnt2 = a2 if a2 < b - cnt1 else b - cnt1