"use strict";
const main = arg => {
  let city = arg.split("\n")[0];
  let monster = arg.split("\n")[1].split(" ").map(n=> n*1);
  let yusya =  arg.split("\n")[2].split(" ").map(n=> n*1);
  let ans = 0;
  for(let i = 0; i < city; i++){
    // まずは左側にあるモンスターを全力で倒す
    let left = Math.min(monster[i],yusya[i]);
    ans += left;
    monster[i] -= left;
    yusya[i] -= left;
    
    // 残った戦力で右を全力で倒す
    let right = Math.min(monster[i+1],yusya[i]);
    ans += right;
    monster[i+1] -= right;
    yusya[i] -= right;
  }
  console.log(ans);
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));
