#45435: easy


0801elmer666@gmail.com (薛冠志)

學校 : 國立霧峰高級農工職業學校
編號 : 273218
來源 : [106.107.218.192]
最後登入時間 :
2025-07-28 20:28:46

a, b = map(int,input().split())
num = int(input())
time = list(map(int,input().split()))
total = 0
for i in range(num):
  total_num = 0
  one = a + b
  plus = time[i] % one
  green = plus - a
  if green < 0:
    total_num = 0
  elif green == 0:
    total_num = b
  else:
    total_num = b - green
  total += total_num
print(total)