peterverebics/CodeNet_Python_118 huggingface dataset:
n,x,t=map(int,input().split())
a=round(n/x)
print(a*t)
total, max, time=map(int, input().split())

print (time*(int(total/max)+1))
N,X,T=map(int,input().split())
print((N//X)*T+1)
from sys import stdin

data = stdin.read().split()
N, X, T = int(data[0]), int(data[1]), int(data[2])

if N % X == 0:
  print(T*N/X)
else:
  print(T*(N//X+1))
N, X, T = map(int,input().split())
if T % X == 0:
  print( T // X )
else:
  print( T // X + 1 )
import math

line = input()

strL = line.split()
N = int(strL[0])
X = int(strL[1])
T = int(strL[2])

ans = math.floor(N / X) * T

print(ans)
n,x,t = map(int,input().split())

if (n%x == 0):
    times = n//x
else:
    times = (n//x)*t + t

print(times)
N, X, T = map(int, input().split())

if N % X == 0:
    print(N*T)
else:
    print((N//X + 1) * T)
n, x, t = map(int, input().split())
print((n // x) * t)
n, x, t = map(int, input().split())
if x == 1:
    print(n*t)
else:
    k = int(n/x) + 1
    print(t*k)
N,X,T=map(float,input().split())
import math 
A=N/X 
A= math.ceil(A)
print(A*T)
n,x,t = map(int,input().split())
print((n//x+1)*t)
N,X,T = map(int, input().split())
print(int(N/X+1)*T)
inputTime = input()
arr = inputTime.split()
N = int(arr[0])
X = int(arr[1])
T = int(arr[2])

if 1 <= N <=1000:
    if 1 <= X <=1000:
        if 1 <= T <=1000:
            print(int(N*T/X))
N,X,T =map(int, input().split()) 
print(T*(int(N/X)+1))
N, X, T = map(int, input().split())
cnt = (N // X) + 1
time = cnt * T
print(time)
N, X, T = map(int, input().split())
print(T *(N//X + 1) if N%X != 1 else T * (N // X))
N, X, T = map(int, input().split())
mod = N % X
if mod == 0:
    print(N * T)
else:
    print(N//mod * T)
n, x, t = list(map(int, input().split()))

a = (n/x)

if int(a) == a:
    a = a
else:
    a = int(a)+1

print( a*t)
import math

n,x,t=map(float,input().split())

print(math.ceil(n/x)*t)
N,X,T = map(int,input().split())
print(((N//X)+1)*T)
n,x,t = map(int,input().split())
if x == 1 | n%x ==0:
  print((n//x)*t)
else:
  print((n//x)*t)
N, X, T = map(int, input().split())

if N <= X:
    print(T)
else:
    a = N // X
    b = a * T
    c = b + T
    print(c)
N,X,T = map(int,input().split())

if((N - X ) <= X):
    print(T + T)
if((N - X) > X):
    print(T*T)
if((N == X)):
    print(T)
if(N < X):
    print(T)
N, X, T = map(int, input().split())

cnt = N // X

if cnt == 0:
    print(T)
else:
    print(cnt*T)
N,X,T=map(int,input().split())
if N//X==0:
  t=(N//X)*T
else:
   t=((N//X)+1)*T
print(t)
N,X,T= map(int, input().split())

print((int(N / X) + 1) * T)
N,X,T=list(map(int,input().split(' ')))
if N%T!=0:
    print(T*(N//X+1))
else:
    print(T*(N//X))
n,x,t=map(int,input().split())
k=n//x
print((k+1)*t)
import math
N,X,T = map(int,input().split())
print(math.floor(N/X)*T)
n,x,t=list(map(int,input().split()))
a=1
q=0
while(q==0):
  if(a*x>n):
    print(a*t)
    q=1
  else:
    a=a+1
n,x,t = map(int,input().split())
if n%x==0:
    print(n/x*t)
else:
    print(((n//x)+1)*t)
N,X,T = map(int,input().split())
print(T*(N/X+1))
string = input("Enter your input: ")

print(string)

string = string.split()


n = int(string[0])
x = int(string[1])
t = int(string[2])

if(n%x == 0):
    res = int(n/x) * t
    print(res)
else:
    res = (int(n/x) + 1) * t
    print(res)
import numpy as np

N, X, T = map(int, input().split())
n=1
while T*n < np.ceil(N/X):
  n+=1

print(T*n)
n,x,t = map(int,input().split())
a = (n//x + 1)*t
print(a)
n,x,t=map(int,input().split())
if n%x==0:
  print(n/x*t)
else:
  print((n/x+1)*t)
# Nは総数　　Xはワンセットの個数　Tはワンセットにかかる時間　
Tako_lists = input().split()
N = int(Tako_lists[0])
X = int(Tako_lists[1])
T = int(Tako_lists[2])

if N // X == N / X:
    print(N / X * T)
else:
    print((N // X + 1 ) * T)
n = list(map(int, input().split()))
a = n[0] // n[1]
print((a + 1) * n[2])
n, x, t = map(int, input().split())
nt = (n // x) + 1
print(nt * t)
N,X,T = map(int,input().split())
if N % (X*T) ==0:
    a = (N //X)*T
else :
    a = (N //X +1)*T
print(a)
N, X, T = map(int, input().split())
if N % T > 0:
  ret = (N // X + 1) * T
else:
  ret = (N // X) * T
print(ret)
n,x,t=map(int,input().split())
m= t//x
print(n*m)
n,x,t=map(int,input().split())
if n<=x:
  print(t)
else:
  while(n>x):
    x+=x
    t+=t
  print(t)
N, X, T = (int(d) for d in input().split())

print((N // X) * T)
N, X, T = [int(i) for i in input().split()]
print((N // X) * T)
(n, x, t) =  map(int, input().split(' '))
r = round(n/x)
print(t*x)
n, x, t = map(int, input().split())
print((n + x - 1 // x) * t)
a = list(map(int, input().split()))
if a[0]%a[1]==0:
  print(a[0]//a[1])
else:
  print(a[2]*(a[0]//a[1])+a[2])
n, x, t = map(int,input().split())

if n%x==0:
  print((n//x)*t)
else:
  n = n//2 +1
  print(n*t)
n,x,t=map(int,input().split())

p=n//x

print(t*(p+1))
n, x, t = map(int, input().split())
nt = (n + x - 1) / x 
print(int(nt * t))
n, x, t = input().split()
n = int(n)
x = int(x)
t = int(t)

if n % x == 0:
  print((n/x)*t)
else:
  print((n//x)*t)
N, X, T = map(int, input().split())

for i in range(1, 1000):
    if N-X*i <= X:
        print(T*(i+1))
        exit()
n, x, t = map(int, input().split())

print((n//x + 1) * t )
n, x, t = map(int, input().split())
a = n % x
b = n // x


if n % x == 0:
    print(n/x*t)
else:
    print((b*t)+(t))
N, X, T = map(int, input().split())
print((int(N / X) + 1) * T)
N,X,T=map(int,input().split())
a=N//X
c=a*T+T
print(c)
N,X,T = map(int,input().split())

print(T*(N//X))
a = input("N X T").split()
n = int(a[0])
x = int(a[1])
t = int(a[2])
ans = (n // x) * t
if n % x > 0:
    ans += t
print(ans)
# -*- coding: utf-8 -*-
"""
Created on Sat Aug 22 20:59:55 2020

@author: naoki
"""
import sys 

N,X,T = map(int,input().split())

for i in range(N):
    if N<=X*(i+1):
        time = T*(i+1)
        print(time)
        sys.exit
N, X, T = map(int, input().split())
print(T * ((N // X) + 1))
n, x, t = map(int,input().split())
if n/x == 0:
  print((n/x)*t)
else:
  print(int(((n/x)+1)*t))
N,X,T = map(int, input().split())
times, mod = divmod(N,X)
if mod == 0:
  print(times * T)
else:
  print(times * T + 1)
def probA():
    N, X, T = map(int, input().split())

    t = 0
    while N > 0:
        N //= X
        t += T
    print(t)


if __name__ == '__main__':
    probA()
N,X,T=map(int,input().split())
print(N//X*T)
n,x,t=map(int,input().split())
print(t*(n//x+1))
n, x, t = map(int, input().split())
if n%x==0:
  print(n*t/x)
else:
  print( (int(n/x)+1)*t )
N,X,T= map(int, input().split())
if N%X == 0:
    A = N/X*T
if N%X != 0:
    A = (N//X+1)*T
print(A)
def calculate(N,X,T):
    x = N // X
    if x ==0:
        return T
    elif not N % X == 0:
        return (x + 1)*T;
    else:
        return x*T
N, X, T = map(int, input().split())
if N % T == 0:
	print((N // X) * T)
else:
	print(((N // X) + 1) * T)
n, x, t = list(map(int, input().split()))

print(t*n//x)
from math import ceil
def resolve():
  N, X, T = map(int, input().split(" "))

  if N > X:
    print(ceil(N/X)*T)

if __name__ == "__main__":
  resolve()
N, X, T = map(int,input().split())
n = 0

if N % X == 0:
    n = N / X
else:
    n = N // X + 1

print(n * T)
n, x, t = map(int, input().split())
print((n / x) * t)
a = input().split(" ")
N = int(a[0])
X = int(a[1])
T = int(a[2])

print((N//X +1)*T)
n, x, t = map(int, input().split())
if x == 1:
    print(t*n)
else:
    print(t*((n // x)+1))
N,X,T = map(int,input().split())
print(N//X*T)
N,X,T = map(int, (input().split(" ")))
SUM = 0
while N >= 0:
    N = N - X
    SUM += 1
res = SUM * T
print(res)
N,X,T=map(int,input().split())
a=N//T
if N%T==0:
  print(a*X)
else:
  print(a*X+X)
def main():
    N, X, T = map(int, input().split())
    
    print(round(N / X) * T)

if __name__ == "__main__":
    main()
n,x,t = map(int,input().split())

print((n//x+1)*t)
N,X,T = map(int,input().split())
import math
print(math.ceil(N / X) * 6)
ls = input().split()
N, X, T = int(ls[0]), int(ls[1]), int(ls[2])
keigo = N // X + 1
print(keigo*T)
n, x, t = map(int, input().split())
print(((n // x) + 1) * t)
n,x,t = map(int,input().split())
tmp = n/x
print(round(tmp)*t)
N, X, T = list(map(int, input().split()))

print((N // X + 1) * T)
N,X,T = map(int, input().split())
print(int(N*T/X))
N,X,T = map(int,input().split())
if N % (X*T) ==0:
    a = (N //X)*T
else :
    a = ((N //X) +1)*T
print(a)
def main():
  n, x, t = map(int, input().split())
  times = n//x
  amari = n%x
  minutes = times * t
  if amari ==0:
    return print(minutes)
  else:
    return print(minutes + 1)

main()
from math import floor
N, X, T = map(int, input().split())
print(floor(N/X)*T)
import numpy as np

N, X, T = map(int, input().split())

for n in range(1,1000):
    if n>=N/(T*X):
        break
    n+=1

print(T*n)
n,x,t = map(int,input().split())
print(((n/x)+1)*t)
n,x,t = map(int, input().split())

ans = (n//x + 1) * t

print(ans)
import math
n,x,t = map(int,input().split())
if n%x == 0:
    c = n/x
else:
    b = float(n)/float(x)
    c = math.ceil(b)
a = c*t
print(a)
a,b,c=map(int,input().split())
d=a//c
print(d*c+c)
N,X,T = map(int, input().split())
if(N%X!=0):
  A = int(N/X)+1
else:
  A = N/X
print(A*T)
a,b,c=map(int,input().split())
print((a//b)*c)
N, X, T = map(int,input().split())

if N <= X:
  print(T)
else:
  if N % X == 0:
    A = N / X * T
    print(A)
  else:
    B = N // X  * T
    print(B)
N,T,u = map(int,input().split())
print(((N//T)+1)*u)
n,x,t=map(int,input().split())
print(n//x+((n%x)!=0)*t)
n, x, y = list(map(int, input().split()))
print((n // x + 1) * y)
n,x,t = map(int, input().split())
print(t*(n+x-1)/x)
n, x, t = map(int,input().split())
count = 1
while x<n:
  x = x*t
  count+=1
  
print(count*t)
a,b,c=map(int,input().split())
print((1+a//b)*c)
q = input().strip().split()
N, X, T = int(q[0]), int(q[1]), int(q[2])
ans = ((N + X) // X - 1) * T
print(ans)
n, x, t = map(int, input().split())
if n % x == 0:
  print(n/x*t)
else:
  print((int(n/x)+1)*t)
n, x, t = map(int, input().split())

print((n//x) * t) if n%x==0 else print((n//x) * t)
A,B,C=input().split()
A=int(A)
B=int(B)
C=int(C)
D=A/B
D=int(D)
print((D)*C)
n,x,t = map(int,input().split())
if n % x == 0:
    c = n / x
else:
    b = n / x
    c = b // 1
a = c * t
print(a)
a,b,c=(int(x) for x in input().split())

y=(a//b+1)*c

print(y)
import math

N, X, T = map(int, input().split())

print(math.ceil(N / X))
n,x,t= map(int,input().split())
f1=n/x
f2=n//x
if f1==f2:
  print(f2)
else:
  print(f2+1)
N,X,T = map(int,input().split())
ans = (N + X -1) / X * T
print(ans)
N, X, T = map(int, input().split())

for i in range(200):
  if (i+1) * X >= N:
    print((i+1)*T)
    break
N, X, T = map(int,input().split())

print(( N // X + 1 ) * T )
n, x, t = map(int, input().split())

if n%t == 0:
    print(int((n/x)*t))
else:
    print(int((n//x + 1)*t))
n, x, t = map(int, input().split())
cnt = n/x
if n%x > 0:
    cnt += 1
print(int(cnt*t))
N, X, T = map(int, input().split())

t = N // X
s = t % X

if s > 0:
  time = T * (t + 1)
  print(time)

else:
  time = T * t
  print(time)
n,x,k=map(int,input().split(' '))

print(((n/x)+1)*k)
n, x, t = (int(i) for i in input().split())
print(round(n/x) * t)
N, X, T = map(int, input().split())
count = 0
result = 0

if N < X:
  print(T)
else:
  if N % X == 0:
    count = N / X
    result = count * T
  else:
    count = (N // X) + 1
    result = count * T
print(int(result))
N,X,T = map(int, input().split())
print((N//X+1)*T)
n,x,t=input().split()
n=int(n)
x=int(x)
t=int(t)
syou,amari=divmod(n,x)
if amari==0:
  print(syou*t)
else:
  print(syou*(t+1))
N,X,T=input().strip().split()
N,X,T=[int(N),int(X),int(T)]

A=N/X

B=A*T

print(B)
N,X,T=map(int, input().split())
if N%X==0:
    print(N//X)
else:
    print((N//X)+1)
N, X, T = map(int, input().split())
if N <= X:
    print(T)
else:
    print(int(N/X)*T)
A = list(map(int, input().split())) 
c=2
while True:
  b=A[0]-(A[1]*c)
  if b<=0:
    break
  c+=1
print(c*A[2])
if __name__=="__main__":
  ans=0
  x,y,z=map(int,input().split())
  while(x>=0):
    x=x-y
    ans+=z
  print(ans)
n,x,t = map(int,input().split())
print(t*(n//t + 1))
N, X, T = [int(i) for i in input().split()]
print(T * N // X)
n, x, t = map(int, input().split())
if n % x == 0:
  print(n/x*t)
else:
  print((n//x+1)*t)
import math
n,x,t = map(float,input().split())
if n%x == 0:
    c = n/x
else:
    b = n/x
    c = math.ceil(b)
a = c*t
print(a)
N, X, T = list(map(int, input().split()))

shou = N // X
amari = N - shou

if amari == 0:
    print(T * shou)
else:
    print(T * (shou + 1))
N, X, T = map(int, input().split())
if N <= X:
  print(T)
elif N%T == 0:
  print(int(N/X)*T)
else:
  print((int(N/X)*T)+T)
a = input().split()
b = int(a[0])
c = 0

while b >= 0:
  b -= int(a[1])
  c += int(a[2])
  
print(c)
total, max, time=map(int, input().split())

print (time*(total/max)+1)
N,S,T=map(int,input().split())
a=N%S
if a==0:
    print((N/S)*T)
else:
    print(((N//S)+1)*T)
n, x, t = map(int, input().split())
times = n // x
times +=1
print(times*t)
a = input().split(" ")
N = int(a[0])
X = int(a[1])
T = int(a[2])

b = N//X
if N%T != 0:
  b += 1

print(b*T)
n,k,t = map(int,input().split())
count = 0
while n<0:
  n-=k
  count+=1
print(count*t)
n,x,t= map(int, input().split())
a=x//n
print(str(a*t))
N, X, T = map(int, input().split())
n=1
while T*n < N//X:
  n+=1

print(T*n)
N,X,T = [int(i) for i in input().split()]
print(int(N%X*T))
n,x,t=map(int,input().split())
print(t * (n//x + 1))
import sys

data = sys.stdin.read().split()
N = data[0]
X = data[1]
T = data[2]

def takoyaki(N, X, T):
  if N % X==0:
    return T * N / X
  else:
    return T * (N / X + 1)
n,x,t = map(int,input().split())
if x == 1:
  print((n//x)*t)
else:
  print((n//x+1)*t)
n, x, t = input().split()
N = int(n)
X = int(x)
T = int(t)
if N % X == 0:
    c = N / X
else:
    c = int(N / X) + 1 
print(c*T)
N, X, T = map(int, input().split())
QuireTime = (N//X)*T + T
print(QuireTime)
n, x, t = map(int, input().split())
num = n // x + 1
time = t * num
print(time)
#A
N, X, T=map(int, input().split())
print((N/X)*T if N%X ==0 else (N//X+1)*T)
N, X, T = map(int, input().split())
count = 0
result = 0

if N < X:
  print(T)
else:
  if N % X == 0:
    count = N / X
    result = count * T
  else:
    count = (N // X) + 1
    result = count * T
print(result)
N,X,T=map(int, input().split())
if N%X==0:
  print(N/X*T)
else:
  print((int(N/X)+1)*T)
n,x,t = map(int,input().split())
ans = n//x + 1
print(ans*t)
n,x,t=map(int,input().split())
c=0
while c<n:
    c+=t

print(c//t*x)
import sys
def input():
    return sys.stdin.readline()[:-1]


def main():
    n,x,t = map(int,input().split())
    print((n//x + 1) * t)

    
if __name__ == "__main__":
    main()
n, x, t = map(int, input().split())
if n%x==0:
  print(n/x*t)
else:
  print( (int(n/x)+1)*t )
n, x, t = map(int,input().split())
count = 0
while x<n:
  x = x*t
  count+=1
  
print(count*t)
n, x, t = map(int, input().split())
if n % x == 0:
  print(n/x*t)
else:
  a = n // x
  print((a+1)*t)
total, max, time=map(int, input().split())

print (time*((total/max)+1))
n,x,t = [int(i) for i in input().split()]
if n%x==0:
  print(n/x*t)
else:
  print((int(n/x)+1)*t)
N, K, T = map(int, input().split())
ans = (N // K + 1) * T
print(ans)
N, X, T = map(int, input().split())

count = 0
time = 0
while N >= count:
    count += X
    time += T

print(time)
N, X, T = map(int, input().split())
if N % X == 0:
  print(N / X * T)
else:
  print((N / X + 1) * T)
N,X,T= map(int,input().split())
if N%T != 0:
  print((N//X)*T+T)
else:
  print((N//X)*T)
s = input().split()
N = int(s[0])
X = int(s[1])
T = int(s[2])
print((N//X+1)*T)
N, X, T = map(int, input().split())
t = N / X if N % X == 0 else (N // X + 1)
print(f'{t * T}')
N, X, T = map(int, input().split())
if N % T == 0:
  print(int(N / X) * T)
else :
  print((int(N / X) + 1) * T)
N, X, T= map(int, input().split())
c=int(N/X)
print(c*T+T)
N,X,T = map(int, input().split())
print((N // X) * T + (N % X) * T)
s = list(map(int, input().split()))
print(int((s[0]+(s[1]-1))/s[1]*s[2]))
N, X, T = map(int, input().split())
print('N',N)
print('X',X)
print('T',T)

print(N//X+1)
N,X,T=map(int,input().split())
print(((N//X)+1)*T)
N, X, T = list(map(int, input().strip().split()))

ans = (int(N/X)+1)*T

print(ans)
n, x, t = input().split()
n = int(n)
x = int(x)
t = int(t)

if n % x == 0:
  print((n//x)*t)
else:
  print((n//x)*(t+1))
N,X,T = map(int,input().split())
ans = (N + (X -1) / X) * T
print(ans)
a,b,c=map(int,input().split())
ans=a/b
if a%b!=0:
    ans+=1
print(ans*c)
def calculate(N,X,T):
    print(round(N/X * T))
n,x,t=map(int,input().split())

count=2
item=0
time=0

while True:
  if n <= item:
    break
  
  if n > item:
    item=x*count
    time=t*count
    count=count+1

print(time)
n, x, t = map(int, input().split())
 
if n % x > 0:
  print((n//x + 1) * t)
else:
  print(n/x * t)
List=list(map(int,input().split()))
if List[0]<=List[1]:
    print(List[2])
else:
    print(((List[0]//List[1]))*List[2])
n, x, t = input().split()
n = int(n)
x = int(x)
t = int(t)

if n % x == 0:
  print((n//x)*t)
else:
  print((n//x)*t)
n, x, t = map(int, input().split())

if n%t == 0:
    print(int((n//x)*t))
else:
    print(int((n//x + 1)*t))
N, X, T = map(int, input().split())
print(((N//X)+1)*T)
N, X, T = map(int, input().split())

cnt = N // X
if N % X == 0:
  cnt += 1

print(T*cnt)
n, x, t = map(int, input().split())
print(((n // t) + 1) * x)
N,X,T=map(int,input().split())
a=N//X
if N%T==0:
    print(a*T)
else:
    print(a*T+T)
N,S,T=map(int,input().split())
if S<N:
    a=N%S
    if a==0:
        print((N/S)*T)
    else:
        print(((N//S)+1)*T)
else:
    print(T)
N, X, T = map(int, input().split())

a = N / X

min_time = (int(a) + 1) * T

print(min_time)
def resolve():
	N, X, T = map(int, input().split())
	print((N+N%X)//X*T)
resolve()
N, X, T = map(int,input().split())

ans = (N // X + 1)*T

print(ans)
n, x, t = map(int, input().split())
print((n//x+1)*t)
N, X, T = map(int, input().split())
print(-(-N/X)*T)
N, X, T = map(int, input().split())
print((int(N/X)+1)*T)
n,x,t = map(int,input().split())
print((int(n/x)+1)*t)
a = input().split()
a = list(map(int, a))

print((int(a[0]/a[1])+1)*a[2])
[N, X, T] = map(int, input().split())

if N%T > 0:
    print((N//X+1)*T)
else:
    print(N//X*T)
N, X, T = map(int, input().split())
if N%X != 0:
  time = (N//X + 1) * T
elif N%X == 0:
  time = N/X*T
print(time)
s = input().split()

N = int(s[0])
X = int(s[1])
T = int(s[2])

print(((N//X)+1)*T)
n, x, t = map(int, input().split())
v = n//x
print(v*x)
N, X, T = map(int, input().split())
n = (N//X) * T + T
print(n)
N,X,T=list(map(int, input().split()))
a=0
t=0
while a<=N:
    a+=X
    t+=T
print(t)
n, x, t = map(int, input().split())
print(n//x*t)
import math
N,X,T = map(int,input().split())
print(T*(math.floor(N/X)+1))
n,x,t=map(int,input().split())

if n%x==0:
  print(n//x*t)
else:
  print(n//x*t+1)
def main():
    inp = [int(i) for i in input().split()]
    for i in inp:
        if i not in range(1,1001):
            raise ValueError
    if inp[0] % inp[1] == 0:
        print((inp[0]*inp[2])/inp[1])
    else:
        print((int((inp[0]/inp[1]))+1)*inp[2])


if __name__ == '__main__':
    main()
N, X, T = map(int,input().split())

if X != 1:
  print(( N // X ) * T )
else:
  print(( N // X + 1 ) * T )
string = input("Enter your input: ")
string = string.split()
n = int(string[0])
x = int(string[1])
t = int(string[2])

if(n%x == 0):
    res = int(n/x) * t
    print(res)
else:
    res = (int(n/x) + 1) * t
    print(res)
N,X,T = map(int, input().split())
ans = 0
while True:
    N -= X
    ans += T
    if N < 0: break
print(ans)
import sys
input = sys.stdin.readline

def takoyaki(n,x,t):
  acc = 0
  ans = 0
  for i in range(1000):
    if i % t == 0:
      acc += x
    if acc >= n:
      ans = i
      break  
  return ans
if __name__ == "__main__":
  n,x,t = map(int,input().split())
  print(takoyaki(n,x,t))
n,x,t = map(int,input().split())

y = int(n/x)
print(t*y)
N,X,T=map(int,input().split())
ans=(N//X)*T+T
print(ans)
N = int(input())
A = list(map(int,input().split()))

now_max = A[0]
ans = 0

for i in range(N):
  if A[i] > now_max:
    now_max = A[i]
  else:
    ans += now_max - A[i]
print(ans)
import bisect,collections,copy,itertools,math,string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip.split())
def main():
    n = I()
    a = LI()
    bemax = a[0]
    ans = 0
    for i in a[1:]:
        if i > bemax:
            bemax = i
        elif i < bemax:
            ans += bemax - i
    print(ans)
main()
n = int(input())
a = list(map(int,input().split()))

hight_sum = 0
for i in range(n-1):
    hight = 0
    diff = a[i+1] - a[i]
    if diff < 0:
        hight -= diff
        a[i+1] -= diff
        hight_sum += hight
print(hight_sum)
import sys
readline = sys.stdin.buffer.readline

N = int(readline())
A = list(map(int, readline().split()))

ans = 0
height = A[0]
for i in range(1, N):
    h = A[i]
    if h < height:
        ans += height - h

    height = max(height, h)


print(ans)
N=input()
*A, = map(int,input().split())
ans = 0
h = A[0]
for a in A:
    ans += max(0,h-a)
    h = max(h,a)

print(ans)
N = int(input())
A = list(map(int, input().split()))

pre_max = 0
ans = 0
for An in A:
    if pre_max <= An:
        pre_max = An
    else:
        ans += pre_max - An

print(ans)
n=int(input())
a=list(map(int, input().split()))
fumidai=fumidau=0
try:
    for i in range(len(a)):
        kijun=a[i]
        if kijun>a[i+1]:
            fumidau=kijun-a[i+1]
            fumidai+=fumidau
            a[i+1]=a[i+1]+fumidau

except:
    pass
print(fumidai)
n = int(input())
a = list(map(int, input().split()))
maxx, h = 0, 0
for i in range(n):
	maxx = max(maxx, a[i])
	h += maxx - a[i]
print(h)
N = int(input())
array = list(map(int,input().split()))
d,f = 0,array[0]
ans = [0]
for i in range(1,N):
  n = array[i]
  d = f - n
  if d >= 0:
    ans.append(d)
  else:
    ans.append(0)
  if n > f:
    f = n
print( sum(ans) )
N = int(input())
A = [int(i) for i in input().split()]
K = 0
for i in range(N-1):
  if A[i] > A[i+1]:
    S = A[i] - A[i+1]
    # リストの前の最大値を取得して比較しないといけない。
    A[i+1] += S
    K += S
  else:
    pass
print(K)
n = int(input())
an = [int(num) for num in input().split()]

sum = 0
for i in range(len(an)-1):
  if an[i] > an[i+1]:
    sum += an[i] - an[i+1]
    an[i+1] += an[i] - an[i+1]
    
print(sum)
n = int(input())
line=list(map(int,input().split( )))

step_sum=0
h=line[0]

for i in line:
    if i<h:
        step_sum+=h-i
    elif i>h:
        h=i
print(step_sum)
b=s=0
for a in[*open(0)][1].split():a=int(a);b=max(b,a);s+=b-a
print(s)
if __name__ == '__main__':

    n = int(input())

    A = list(map(int,input().split()))

    top = A[0]
    ans = 0
    for i in range(n-1):
        if top > A[i+1]:
            ans += top - A[i+1]
        else:
            top = A[i+1]
    print(ans)
n=int(input())
a=list(map(int,input().split()))
maxa=0
total=0
for i in a:
  maxa=max(maxa,i)
  total=total+maxa-i
print(total)
n=int(input())
a=list(map(int,input().split()))
s=0
for i in range(n-1):
    if a[i+1]<a[i]:
        t=a[i]-a[i+1]
        s+=t
        a[i+1]+=t
print(s)
n = int(input())
a = list(map(int, input().split()))

highest, ans = 0, 0

for l in a:
    if highest > l:
        ans += highest - l
    elif highest < l:
        highest = l
    else:
        pass
print(ans)
N = int(input())
A = [int(i) for i in input().split()]

max = 0
sum = 0
for a in A:
  if a < max:
    sum += max - a
  if a > max:
    max = a

print(sum)
n=int(input())
a=list(map(int, input().split()))
curr=a[0]
ans=0
for i in range(n):
    if a[i]<curr:
        ans+=(curr-a[i])
    else:
        curr=max(curr, a[i])
print(ans)
num = int(input())
height = input().split()

sum = 0
max_height_now = 0
for index in range(num):
  height_now = int(height[index])
  if height_now >= max_height_now:
    max_height_now = height_now
  else:
    sum += max_height_now - height_now

print(sum)
# vim: fileencoding=utf-8


def main():
    n = int(input())
    li = list(map(int, input().split()))
    max = 0
    total = 0
    for i in li:
        if max < i:
            max = i
            continue
        elif max == i:
            continue
        else:
            total += max - i
    print(total)


if __name__ == "__main__":
    main()
n = int(input())
a = list(map(int, input().split()))

mae = a[0]
ans = 0

for i in a:
    if mae > i:
        ans += mae - i
    else:
        mae = i

print(ans)