There are K nuclear reactor chambers labelled from 0 to K-1. Particles are bombarded onto chamber 0. The particles keep collecting in the chamber 0. However if at any time, there are more than N particles in a chamber, a reaction will cause 1 particle to move to the immediate next chamber(if current chamber is 0, then to chamber number 1), and all the particles in the current    chamber will be be destroyed and same continues till no chamber has number of particles greater than N. Given K,N and the total number of particles bombarded (A), find the final distribution of particles in the K chambers. Particles are bombarded one at a time. After one particle is bombarded, the set of reactions, as described, take place. After all reactions are over, the next particle is bombarded. If a particle is going out from the last chamber, it has nowhere to go and is lost.

-----Input-----

The input will consist of one line containing three numbers A,N and K separated by spaces.
A will be between 0 and 1000000000 inclusive.
N will be between 0 and 100 inclusive.
K will be between 1 and 100 inclusive.
All chambers start off with zero particles initially.

-----Output-----

Consists of K numbers on one line followed by a newline. The first number is the number of particles in chamber 0, the second number is the number of particles in chamber 1 and so on.

-----Example-----
Input:
3 1 3
Output:
1 1 0
Explanation
Total of 3 particles are bombarded. After particle 1 is bombarded, the chambers have particle distribution as
"1 0 0". After second particle is bombarded, number of particles in chamber 0 becomes 2 which is greater
than 1. So, num of particles in chamber 0 becomes 0 and in chamber 1 becomes 1. So now distribution is
"0 1 0". After the 3rd particle is bombarded, chamber 0 gets 1 particle and so distribution is "1 1 0" after all
particles are bombarded one by one.

Difficulty: interview

Starter code:

Solutions:
a,n,k = map(int,input().split())
for i in range(k):
 print(a%(n+1),end=' ')
 a=a//(n+1)

# cook your dish here
a,n,k=map(int,input().split())
for i in range(k):
 print(a%(n+1),end=' ')
 a=a//(n+1)
 

a,n,k=list(map(int,input().split()))
s=[]

while k:
 s.append(a%(n+1))
 a=a//(n+1)
 k-=1

print(*s)
 


# cook your dish here
A, N, K = map(int, input().split())

ans = "" + str(A % (N + 1))
p = A // (N + 1)

for i in range(K - 1):
 ans += " " + str(p % (N + 1))
 p = p // (N + 1)

print(ans)

# cook your dish here
A, N, K = map(int, input().split())

ans = "" + str(A % (N + 1))
previous = A // (N + 1)

for i in range(K - 1):
 ans += " " + str(previous % (N + 1))
 previous = previous // (N + 1)

print(ans)

A, N, K = map(int, input().split())

ans = "" + str(A % (N + 1))
previous = A // (N + 1)

for i in range(K - 1):
 ans += " " + str(previous % (N + 1))
 previous = previous // (N + 1)

print(ans)

a,n,k=map(int, input().split())
l=[]
for _ in range(k):
 l.append(a%(n+1))
 a//=(n+1)
print(*l)

a,n,k=map(int, input().split())
l=[]
for _ in range(k):
 l.append(a%(n+1))
 a//=(n+1)
for i in l:
 print(i,end=" ")
print()


# cook your dish here
a,n,k=list(map(int,input().split()))

l=[]
for i in range(0,k):
 l.append(a%(n+1))
 a=a//(n+1)
for i in l:
 print(i,end=" ")
print('')

# cook your dish here
a,n,k=list(map(int,input().split()))

l=[]
for i in range(0,k):
 l.append(a%(n+1))
 a=a//(n+1)
for i in l:
 print(i,end=" ")
print('')

a,n,k=map(int,input().split())
l=[0 for i in range(k)]
j=0
while(j<k):
 l[j]=a%(n+1)
 a=a//(n+1)
 j+=1
for j in l:
 print(j,end=' ')

# cook your dish here
a,n,k=map(int,input().split())
L=[0]*k
for i in range(k):
 L[i]=a%(n+1)
 a=a//(n+1)
for j in L:
 print(j,end=' ')

# cook your dish here
a,n,k=list(map(int,input().split()))
L=[0]*k
for i in range(k):
 L[i]=a%(n+1)
 a=a//(n+1)
print(*L)


a, n, k = map(int, input().split())
arr = [0 for i in range(k)]
i = 0
while a!=0 and i<k:
 arr[i] = a % (n+1)
 a = a // (n+1)
 i += 1
for i in range(k):
 print(arr[i], end=' ')

A, N, K = map(int, input().split())
R = [0]*K
i = 0

while A != 0 and i < K:
 rem = A % (N + 1)
 R[i] = rem
 A //= N + 1 
 i += 1
 
for num in R:
 print(num, end=' ')
print()



# cook your dish here
x,y,z=map(int,input().split())
s=[0]*z 
y=y+1 
for i in range(z):
 s[i]=x%y 
 x=x//y 
print(*s)

# cook your dish here
a,n,k=input().split()
a,n,k=int(a),int(n),int(k)
klist=[0 for i in range(k)]
for i in range(k):
 klist[i]=a%(n+1)
 a=a//(n+1)
print(*klist)

try:
 a,n,k=map(int,input().split())
 kList=[0 for i in range(k)]
 for i in range(k):
  kList[i]=a%(n+1)
  a=a//(n+1)
 print(*kList)
except:
 pass

def __starting_point():
 a, n, k = list(map(int, input().split()))
 s, i = [], 0
 if(n == 0):
  print(*([0]*k))
 else:
  while(a > 0):
   s.append(a%(n+1))
   a = a//(n+1)
   i += 1
  s = s+[0]*(k-i)
  if(len(s) <= k):
   print(*s)
  else:
   print(*(s[:k]))

__starting_point()

def __starting_point():
 a, n, k = list(map(int, input().split()))
 s, i = [], 0
 if(n == 0):
  print(*([0]*k))
 else:
  while(a > 0):
   s.append(a%(n+1))
   a = a//(n+1)
   i += 1
  s = s+[0]*(k-i)
  if(len(s) <= k):
   print(*s)
  else:
   print(*(s[:k]))

__starting_point()

x, y, z =list(map(int,input().split()))
s=[0]*z
y=y+1
for i in range(z):
 s[i]=x%y
 x=x//y
print(*s)


a,n,k=list(map(int,input().split()))
l=[]
c=0
while c!=k:
 x=a%(n+1)
 l.append(x)
 a=a//(n+1)
 c+=1
print(*l)
 


# cook your dish here
a,n,k = map(int,input().split())

res = [0]*k

for i in range(k):
 res[i] = ((a//((n+1)**i))%(n+1))
 
print(' '.join(str(i) for i in res))

# cook your dish here
a,n,k=map(int, input().split())
b=[0]*k
i=0
while(i<k):
 b[i]=a%(n+1)
 a=a//(n+1)
 i+=1
print(*b, sep=' ')