output_description: Print the maximum total number of monsters the heroes can defeat.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      N
      A_1 A_2 ... A_{N+1}
      B_1 B_2 ... B_N
attempt: i1 = int(input())
  i2 = input().split(" ")
  i3 = input().split(" ")
  
  w = -1
  s = 0
  
  for i in range(i1):
      ii2 = int(i2[i])
      ii3 = int(i3[i])
      #  print(ii2)
      #  print(ii3)
  
      if ii2 > ii3:
          # 引ききれた場合
          s += ii3
      else:
          s += ii2
          w = ii3 - ii2
  
          iii2 = int(i2[i + 1])
  
          if iii2 > w:
              s += w
              w = iii2 - w
          else:
              s += iii2
              w = 0
  
  print(s)
  
problem_description: Statement
  
  There are N+1 towns. The i-th town is being attacked by A_i monsters.
  
  We have N heroes. The i-th hero can defeat monsters attacking the i-th or
  (i+1)-th town, for a total of at most B_i monsters.
  
  What is the maximum total number of monsters the heroes can cooperate to
  defeat?
samples: [{"input": "2\n    3 5 2\n    4 5", "output": "9\n    \n\nIf the heroes choose the monsters to defeat as follows, they can defeat nine\nmonsters in total, which is the maximum result.\n\n  * The first hero defeats two monsters attacking the first town and two monsters attacking the second town.\n  * The second hero defeats three monsters attacking the second town and two monsters attacking the third town.\n\n* * *"}, {"input": "3\n    5 6 3 8\n    5 100 8", "output": "22\n    \n\n* * *"}, {"input": "2\n    100 1 1\n    1 100", "output": "3"}]