#45049: APCS(高一考生)「含正確解答」


tcr980328@gmail.com (蔡承融)

學校 : 不指定學校
編號 : 286056
來源 : [101.8.224.223]
最後登入時間 :
2025-09-28 12:45:40

c=0
d=0
e=0
f=0
g=0
a,b=map(int, input().split())
e=a+b
n = int(input())
list_a = list(map(int, input().split()))
for i in range(n):
    c=list_a[i]%(e)
    if  c != 0 and c >= a:
        f=c-a
        g=b-f
        d+=g
    else: 
        d+=0
print(d)