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

dp = [0] * n

dp[0] = costs[0]

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

result = dp[n-1]
print(result)

