#45072: Python 三行解


210039@sdhs.ntpc.edu.tw (人類)


a, b = map(int, input().split())
n = int(input())
print(sum([(a+b)-i%(a+b) for i in list(map(int, input().split())) if i%(a+b) >= a]))
#45073: Re: Python 三行解


leeguanhan0909@gmail.com (李冠翰)


a, b = map(int, input().split())
n = int(input())
print(sum([(a+b)-i%(a+b) for i in list(map(int, input().split())) if i%(a+b) >= a]))

兩行解