# Задача I. Крыши
n = int(input())
heights = list(map(int, input().split()))
costs = list(map(int, input().split()))

dp_left = [0] * n
dp_right = [0] * n

# Инициализация начальных значений
dp_left[0] = costs[0]
dp_right[0] = costs[0]

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

result = min(dp_left[n-1], dp_right[n-1])
print(result)
