object Main extends App {
  var a = readInt
  var b = readLine.split(" ").map(_.toInt)
  var c = readLine.split(" ").map(_.toInt)
  var sum = 0L
  for(i <- 0 until a) {
    if(b(i) > 0){
      if(c(i) < b(i)) {     
        sum = sum + c(i)
        c(i)=0
      }
      if(c(i)>=b(i)) {
        sum = sum + b(i)
        c(i) -= b(i)
      }
    }
    
    if(c(i)>0){
      if(c(i) < b(i + 1)) {
        sum = sum + c(i)
        b(i+1) -= c(i)
        c(i)=0
      }
      if(c(i)>=b(i + 1)) {
        sum = sum + b(i+1)
        b(i+1) = 0
      }
    }
  }
  print(sum)
}