Bimokh is Mashmokh's boss. For the following n days he decided to pay to his workers in a new way. At the beginning of each day he will give each worker a certain amount of tokens. Then at the end of each day each worker can give some of his tokens back to get a certain amount of money. The worker can save the rest of tokens but he can't use it in any other day to get more money. If a worker gives back w tokens then he'll get $\lfloor \frac{w \cdot a}{b} \rfloor$ dollars. 

Mashmokh likes the tokens however he likes money more. That's why he wants to save as many tokens as possible so that the amount of money he gets is maximal possible each day. He has n numbers x_1, x_2, ..., x_{n}. Number x_{i} is the number of tokens given to each worker on the i-th day. Help him calculate for each of n days the number of tokens he can save.


-----Input-----

The first line of input contains three space-separated integers n, a, b (1 ≤ n ≤ 10^5; 1 ≤ a, b ≤ 10^9). The second line of input contains n space-separated integers x_1, x_2, ..., x_{n} (1 ≤ x_{i} ≤ 10^9).


-----Output-----

Output n space-separated integers. The i-th of them is the number of tokens Mashmokh can save on the i-th day.


-----Examples-----
Input
5 1 4
12 6 11 9 1

Output
0 2 3 1 1 
Input
3 1 2
1 2 3

Output
1 0 1 
Input
1 1 1
1

Output
0

Difficulty: interview

Starter code:

Solutions:
"""
Codeforces Round 240 Div 1 Problem B

Author  : chaotic_iak
Language: Python 3.3.4
"""

class InputHandlerObject(object):
    inputs = []

    def getInput(self, n = 0):
        res = ""
        inputs = self.inputs
        if not inputs: inputs.extend(input().split(" "))
        if n == 0:
            res = inputs[:]
            inputs[:] = []
        while n > len(inputs):
            inputs.extend(input().split(" "))
        if n > 0:
            res = inputs[:n]
            inputs[:n] = []
        return res
InputHandler = InputHandlerObject()
g = InputHandler.getInput

############################## SOLUTION ##############################
n,a,b = g()
n,a,b = int(n),int(a),int(b)
c = [int(x) for x in g()]
r = []
for i in c:
    r.append(str(((i*a) % b) // a))
print(" ".join(r))

from math import *
n,a,b=map(int,input().split())
x=list(map(int,input().split()))
ans=[0]*n
for i in range(n):
    ans[i]=x[i]-ceil(int(x[i]*a/b)*b/a)
print(*ans)

n, a, b = list(map(int, input().split()))
coins = list(map(int, input().split()))
result = [str((x * a % b) // a) for x in coins]
print(" ".join(list(result)))


import sys


[n,a,b] = list(map(int, sys.stdin.readline().split()))

buttons = list(map(int, sys.stdin.readline().split()))

res = []

for x in buttons:
	money = int(1.0 * x * a / b)
	# print("money =", money)
	rest = x - 1.0 * money * b / a
	# print("rest =", rest)
	res.append(int(rest))

print(" ".join(map(str, res)))











def mymod(x,a,b):
    import math
    return x - math.ceil(int(x*a/b))*b/a
n,a,b = map(int,input().strip().split())
x= list(map(int,input().split()))
for q in x:
    print(int(mymod(q,a,b)),end= ' ')

import math
_, a, b = list(map(int, input().split()))
jet = list(map(int, input().split()))


def jtd(w):
    #d = (w*a)//b
    j = (w*a)%b
    return j//a

for i in jet:
    print(int(jtd(i)), end=' ')
print()


import math
n, a, b = map(int, input().split())
our_list = list(map(int, input().split()))
for i in range(n):
    print(our_list[i] - (math.ceil(((our_list[i] * a) // b) * b / a)), end = ' ')

import math

def f2(x, a, b):
    t = math.floor(x * a / b)
    r = x % t if t > 0 else x
    #print(x, a, b, r)
    return r
    
def f(x, a, b):
    r = (x * a) % b
    #print(x, a, b, r)
    return r

n, a, b = list(map(int, input().split(" ")))

x = list(map(int, input().split(" ")))

#r = [f(x[i], a, b) for i in range(len(x))]
r = [int(((x[i] * a) % b) / a) for i in range(len(x))]
    
print(" ".join(map(str, r)))


import math
n, a, b = list(map(int, input().split()))
x = [int(i) for i in input().split()]
ans = [0] * n
for i, w in enumerate(x):
    r = (w * a) // b
    ans[i] = w - math.ceil(r * b / a)
    if ans[i] < 0:
        ans[i] = 0
print(' '.join(str(i) for i in ans))


import math
x=input("").split(' ')
x=[int(y) for y in x]
a= x[0]
b=x[1]
c=x[2]
l=input("").split(' ')
str2=""
l=[int(y) for y in l]
for g in range (0, a):
   t=l[g]
   if ((t*b)/c==math.floor((t*b)/c)):
       str2=str2+"0 "
   else:
        ttt= t*b
        equate=math.floor(ttt/c)
        if ((equate*c)%b==0):
            unawesome= equate*c/b
            str2=str2+str(int(t-unawesome))
            str2=str2+" "
        else:
            unawesome= math.floor(equate*c/b)+1
            str2=str2+str(int(t-unawesome))
            str2=str2+" "
print(str2)


n, a, b = map(int, input().split())
coins = list(map(int, input().split()))
for i in range(n):
    coins[i] = ((coins[i] * a) % b) // a
print(*coins)

def main():
    n, a, b = list(map(int, input().split()))
    x_list = list(map(int, input().split()))
    res = list()

    for x in x_list:
        res.append(str(x * a % b // a))

    print(' '.join(res))

def __starting_point():
    main()
__starting_point()

n, a, b = map(int, input().split())
t = [w - 1 - (((w * a) // b) * b - 1) // a for w in map(int, input().split())]
print(' '.join(map(str, t)))

__author__ = 'Lipen'

def main():
    n, a, b = map(int, input().split())
    x = list(map(int, input().split()))

    answer = list(map(lambda i: int( x[i] - (int(x[i] * a/b)) / a*b ), range(n)))

    print(' '.join(map(str, answer)))

main()

from math import *
n,a,b=map(int, input().split())
x=list(map(int, input().split()))
ans=[0]*n
for i in range(n):
    ans[i]=x[i]-ceil(int(x[i]*a/b)*b/a)
print(*ans)

from math import *
n,a,b=map(int, input().split())
x=list(map(int, input().split()))
ans=[0]*n
for i in range(n):
    ans[i]=x[i]-ceil(int(x[i]*a/b)*b/a) 
print(*ans)

n,a,b=map(int, input().split())
d=list(map(int, input().split()))
ans=[0]*n
for i in range(n):
    ans[i]=int(d[i]*a%b/a)
print(*ans)

import math

n,a,b=map(int,input().split())
xlist=[int(x) for x in input().split()]
savestring=''

for i in range(n):
    maxmoney=math.floor(xlist[i]*a/b)
    saves=xlist[i]-math.ceil(maxmoney*b/a)
    savestring+=str(saves)+' '
    
print(savestring)

import sys

n, a, b = map(int, sys.stdin.readline().split())
w_arr = map(int, sys.stdin.readline().split())

print(" ".join( map(str, [(w * a % b) // a for w in w_arr] )))

n,a,b=map(int, input().split())
x=list(map(int, input().split()))
ans=[0]*n;
for i in range(n) : 
    ans[i]=int(x[i]*a%b/a)
print(*ans)

n, a, b=map(int, input().split())
d=list(map(int, input().split()))
ans=[0]*n
for i in range(n):
    ans[i]=(int)(d[i]*a%b/a)
print(*ans)

R = lambda:map(int, input().split())
n, a, b = R()
print(" ".join(map(str, (((w * a) % b) // a for w in R()))))

R = lambda:map(int, input().split())
n, a, b = R()
for w in R():
  print(w * a % b // a, end=" ")

n, a, b = [int(c) for c in input().split()]
days = [int(c) for c in input().split()]
res = []

for i in range(len(days)):
    p = (days[i] * a) % b
    f1 = int(p // a)
    res.append(f1)

print(' '.join(map(str,res)))

n, a, b=map(int, input().split())
d=list(map(int, input().split()))
ans=[0]*n
for i in range(n):
    ans[i]=(int)(d[i]*a%b/a)
print(*ans)