#45059: python


s210367@student.cysh.cy.edu.tw (張少謙)

學校 : 國立嘉義高級中學
編號 : 263937
來源 : [61.223.150.87]
最後登入時間 :
2025-06-14 20:55:00

g, r = map(int, input().split())
n = int(input())
time = list(map(int, input().split()))
rg = g + r
wtime = 0
for a in time:
    if (a % rg) >= g:
        wtime += (rg - (a % rg))
print(wtime)