def read_line_to_i; readline.split(" ").map(&:to_i) end

n = read_line_to_i[0]

a_list = read_line_to_i
b_list = read_line_to_i

number_of_attacked_monsters = 0

b_list.each_index {|i|
  # About i
  if a_list[i] >= b_list[i]
    number_of_attacked_monsters += b_list[i]
    a_list[i] -= b_list[i]
    b_list[i] = 0
  else
    number_of_attacked_monsters += a_list[i]
    b_list[i] -= a_list[i]
  end

  # About i+1
  if a_list[i+1] >= b_list[i]
    number_of_attacked_monsters += b_list[i]
    a_list[i+1] -= b_list[i]
  else
    number_of_attacked_monsters += a_list[i+1]
    b_list[i] -= a_list[i+1]
  end
}

puts number_of_attacked_monsters
