import java.util.Scanner


object Main {
  def main(args: Array[String]): Unit = {
    val sc = new Scanner(System.in)
    val n = sc.nextInt()

    var ans = 0

    val enemies = new Array[Int](n + 1)
    for (i <- enemies.indices) {
      enemies(i) = sc.nextInt()
    }

    val hero = new Array[Int](n)
    for (i <- hero.indices) {
      hero(i) = sc.nextInt()

    }

    for (i <- hero.indices) {
      if (hero(i) <= enemies(i)) {
        enemies(i) -= hero(i)
        ans += hero(i)
      } else {
        hero(i) -= enemies(i)
        ans += enemies(i)
        val m = math.min(hero(i), enemies(i + 1))
        enemies(i + 1) -= m
        ans += m
      }
    }

    println(ans)
  }
}