n = int(input())
heights = list(map(int, input().split()))
costs = list(map(int, input().split()))

if n == 1:
    print(costs[0])
else:
    dp = [0] * n
    dp[0] = costs[0]
    dp[1] = min(heights[0], costs[1])

    for i in range(2, n):
        dp[i] = min(dp[i - 1] + heights[i], dp[i - 3] + heights[i])

    print(dp[-1])
