2025年1月14日 星期二

apcs 紅綠灯

 # ans 1

# a,b = map(int,input().split())

# n = int(input())

# ts = [int(i) for i in input().split()] 

# sw = 0

# for t in ts:

#   r = t % (a+b)

#   if r<a:

#     w = 0

#   elif r==a:

#     w = b

#   else:

#     w = b - (r-a)

#   sw = sw + w

# print(sw)


# ans 2

# a,b = map(int,input().split())

# n = int(input())

# ts = [int(i) for i in input().split()] 

# sw = 0

# for t in ts:

#   r = t % (a+b)

#   if r<a:

#     w = 0

#   else:

#     w = b - (r-a)

#   sw = sw + w

# print(sw)


# ans 3

a,b = map(int,input().split())

n = int(input())

print(sum( [ 0 if t % (a+b)<a else b-(t % (a+b)-a) for t in [int(i) for i in input().split()]]))


# StdIn

# 4 3

# 3

# 12 16 25

# Output:

# 5

沒有留言:

張貼留言