The finalists of the "Russian Code Cup" competition in 2214 will be the participants who win in one of the elimination rounds.

The elimination rounds are divided into main and additional. Each of the main elimination rounds consists of c problems, the winners of the round are the first n people in the rating list. Each of the additional elimination rounds consists of d problems. The winner of the additional round is one person. Besides, k winners of the past finals are invited to the finals without elimination.

As a result of all elimination rounds at least n·m people should go to the finals. You need to organize elimination rounds in such a way, that at least n·m people go to the finals, and the total amount of used problems in all rounds is as small as possible.


-----Input-----

The first line contains two integers c and d (1 ≤ c, d ≤ 100) — the number of problems in the main and additional rounds, correspondingly. The second line contains two integers n and m (1 ≤ n, m ≤ 100). Finally, the third line contains an integer k (1 ≤ k ≤ 100) — the number of the pre-chosen winners. 


-----Output-----

In the first line, print a single integer — the minimum number of problems the jury needs to prepare.


-----Examples-----
Input
1 10
7 2
1

Output
2

Input
2 2
2 1
2

Output
0

Difficulty: interview

Starter code:

Solutions:
c,d=list(map(int,input().split()))

n,m=list(map(int,input().split()))

k=int(input())

z=0
best=10**10
while(1):
    x=n*m-k
    x-=z*n
    best=min(best,z*c+(max(x,0)*d))
    if(x<0):
        break
    z+=1
print(best)
    


[c, d], [n, m], k = list(map(int, input().split())), list(map(int, input().split())), int(input())
left = n * m - k
if left <= 0:
    print(0)
else:
    print(min(left // n * c + left % n * d, (left + n - 1) // n * c, left * d))


#import sys
#sys.stdin = open('input.txt','r')
c, d = map(int, input().split())
n, m = map(int, input().split())
k = int(input())
L = 10001
for f in range(m + 1):
	for g in range(n * m + 1):
		if f * n + g + k >= n * m:
			L = min(L, f * c + g * d)
print(L)

c, d = map(int, input().split())
n, m = map(int, input().split())
p = 0
k = int(input())
if m*n <= k:
    print(0)
else:
    a = [0]*(m*n+1)
    #a[k+1] = min(c,d)
    for i in range(k+1,m*n+1):
        a[i] = min(a[i-n]+c, a[i-1]+d)
    print(a[m*n])

c, d = list(map(int, input().split()))
n, m = list(map(int, input().split()))
f = n * m
k = int(input())
result = 0
uch = k

useosn = usedop = 0

while uch < f:
    if f-uch >= n:
        if c/n < d:
            result += c
            uch += n
        else:
            result += d
            uch += 1
    else:
        if c > (d*(f-uch)):
            while uch < f:
                result += d
                uch += 1
        else:
            result += c
            uch += n

print(max(0, result))





c, d = list(map(int, input().split()))
n, m = list(map(int, input().split()))
k = int(input())

s = max(n * m - k, 0)
res = 0
while s:
    if c > min(s, n) * d:
        res += min(s,n) * d
    else:
        res += c
    s -= min(s,n)
print(res)


def readln(): return tuple(map(int, input().split()))

c, d = readln()
n, m = readln()
k, = readln()

ans = 1 << 30
for x in range(10001):
    y = max(0, n * m - k - n * x)
    if y >= 0 and ans > c * x + d * y:
        ans = c * x + d * y
print(ans)

def f(x, y): return x * c + y * d
c, d = map(int, input().split())
n, m = map(int, input().split())
k = n * m - int(input())
x, s = 0, max(0, k * d)
while k > x * n:
    t = f(x, k - x * n)
    if t < s: s = t
    x += 1
print(min(s, f(x, 0)))

import math
c,d=list(map(int,input('').split()))
n,m=list(map(int,input('').split()))
k=int(input(''))
if n*m-k<0:
    print('0')
    return
if 1/d>n/c:    print((n*m-k)*d)
else:
    if (math.ceil((n*m-k)/n)*c)<((n*m-k)//n)*c+((n*m-k)%n)*d: print(math.ceil((n*m-k)/n)*c)
    else: print(((n*m-k)//n)*c+((n*m-k)%n)*d)







            
            
        
        
    


                



problems = input().split()
c = int(problems[0])
d = int(problems[1])
n_m = input().split()
n = int(n_m[0])
m = int(n_m[1])
k = int(input())

t = n * m - k # нужное воличество людей, кроме уже прошедших
ans = 100000000  # количество задач
i = 0
while i*n <= t: # если число проходящих по основным раундам не больше, чем надо
    ans = min(ans, (t - i*n) * d + i*c)
    i += 1
ans = min(ans, i*c)
print(ans)





#c,d,n,m,k=map(int,input().split())
c, d = list(map(int, input().split()))
n, m = list(map(int, input().split()))
k = int(input())

# c и d (1 ≤ c, d ≤ 100)  количество задач в основном и дополнительном раундах 
# n и m (1 ≤ n, m ≤ 100) n победителей
# k (1 ≤ k ≤ 100) — число заранее отобранных победителей

S = 0
if n*m>k :   
    nub = n*m-k
    S = 100000000000
    S0 = S
    i=0
    while S0<=S and i<=int(nub/n+2):
        S = S0  
        S0 = i*c + d*max(0, nub-n*i)
        #print(i,S,S0)
        i += 1

print(S)




import sys

c, d = map(int, sys.stdin.readline().split())
n, m = map(int, sys.stdin.readline().split())
k = int(sys.stdin.readline())

total = n * m - k
if total <= 0:
  print(0)
  return

a = [d*i for i in range(0, total+1)]

for i in range(1, total+1):
  if i <= n:
    if a[i] > c:
      a[i] = c
  else:
    if a[i-n] + c < a[i]:
      a[i] = a[i-n] + c

print( a[total] )

c, d = list(map(int, input().split()))
n, m = list(map(int, input().split()))
k = int(input())
kolvo = m * n - k
if kolvo < 0:
	print(0)
	return
print(min(c * (kolvo // n), d * n * (kolvo // n)) + min(c, d * (kolvo % n)))



c, d = list(map(int, input().split(' ')))
n, m = list(map(int, input().split(' ')))
k = int(input())
dp = [0] * 100000
need = n*m - k

if need <= 0:
    print(0)
    quit()


for i in range(1, 100000):
    dp[i] = min(dp[i-n]+c, dp[i-1]+d)

print(dp[need])


c, d = list(map(int, input().split()))
n, m = list(map(int, input().split()))
k = int(input())
total = n * m - k
if k >= n * m:
  print(0)
elif c < d:
  if total % n == 0:
    print(((total // n)) * c)
  else:
    print(((total // n) + 1) * c)
else:
  nr = 0
  nn = (c / n)
  nm = d
  if nn < nm:
    #while (nr * n) + n < total:
    #  nr += 1
    nr = total // n
    npn = nr * c
    if nr * n < total:
      npn = (nr + 1) * c
    npm = nr * c + d * (total - nr * n)
    print(min(npn, npm))
  else:
    print(d * total)


c,d = [int(x) for x in input().strip().split()]
n,m = [int(x) for x in input().strip().split()]
k = int(input().strip())

t = n*m-k
if t<=0:
    print(0)
else:
    dp = [0]*(t+1)
    for i in range(1,t+1):
        dp[i]=min(dp[i-1]+d, c+dp[max(0,i-n)])
    print(dp[t])

Pm,Pa = map(int, input().split())
N,M = map(int, input().split())
k = int(input())
Rm = Pm / N
Ra = Pa

lo,hi = 0,100000


def count(mid):
	nonlocal Pm,Pa,Rm,Ra,N
	ans = 0
	while True:
		if mid < min(Pm, Pa):
			break
		if Ra <= Rm:
			if mid >= Pa:
				ans += 1
				mid -= Pa
			else:
				ans += N
				mid -= Pm
		else:
			if mid >= Pm:
				ans += N
				mid -= Pm
			else:
				ans += 1
				mid -= Pa
	return ans
while lo < hi:
	mid = (lo + hi) >> 1
	if count(mid) >= N * M - k:
		hi = mid
	else:
		lo = mid + 1
print(lo)

# Made By Mostafa_Khaled 
bot = True 
c, d = list(map(int, input().split()))
n, m = list(map(int, input().split()))
k = int(input())
kolvo = m * n - k
if kolvo < 0:
	print(0)
	return
print(min(c * (kolvo // n), d * n * (kolvo // n)) + min(c, d * (kolvo % n)))



# Made By Mostafa_Khaled


c,d = list(map(int, input().split(" ")))
n, m = list(map(int, input().split(" ")))
k = int(input())
mini = n*m-k
if mini < 1:
	print(0)
elif d * n <= c: # easier one at a time
	print(d*mini)
else:
	total = (mini // n) * c
	mini = mini % n
	total += min(c, d*mini)
	print(total)

c,d=map(int,input().split())
n,m=map(int,input().split())
k=int(input())
tot=n*m
if(k>=tot):
	print("0")
else:
	rem=tot-k
	x=n/c
	y=1/d
	ans=0
	if(x>=y):
		temp=rem//n
		bacha=rem%n
		if(bacha*d<=c):
			ans=temp*c+bacha*d
		else:
			ans=(temp+1)*c
	else:
		ans=rem*d
	print(ans)

c,d = map(int,input().split())
n,m = map(int,input().split())
k = int(input())
x = n*m
if k>=x:print(0);return
if c<=d:
    div,mod=(x-k)//n,(x-k)%n
    if mod>0:div+=1
    print(div*c)
else:
    if d*n<=c:print((x-k)*d)
    else:
        res=(x-k)//n*c
        mod=(x-k)%n
        if c<mod*d:res+=c
        else:res+=mod*d
        print(res)

c,d = map(int,input().split())
n,m = map(int,input().split())
k = int(input())
f = [float('+inf') for i in range(n*m+n+k+2)]
f[0] = f[k] =  0
for i in range(n*m):
    f[i+1] = min(f[i+1],f[i]+d)
    f[i+n] = min(f[i+n],f[i]+c)
print(min(f[n*m:]))

c, d = list(map(int, input().split()))
n, m = list(map(int, input().split()))
k = int(input())
need = n*m - k
if need <= 0:
    print(0)
else:
    r1 = c / n
    if r1 < d:
        div, rest = divmod(need, n)
        cont = div * c
        cont += min(c, d*rest)
        print(max(0,cont))
    else:
        print(need*d)


#Codeforces problem 417A: Elimination

def roof(n,p):
	r = p // n
	if p%n > 0:
		r = r + 1
	return r

c,d = (int(element) for element in input().split())

n,m = (int(element) for element in input().split())

k = int(input())

needed_number_of_problems = 0

#people still needed for the 2214 Russian Code Cup"
p = m*n - k

while p > 0:
	x = roof(n,p)
	if d*p < c*x:
		#get people from the additional rounds
		needed_number_of_problems += d
		p = p - 1
	else:
		#get people from main round
		needed_number_of_problems += c
		p = p - n

print(needed_number_of_problems)

c, d = map(int, input().split())
n, m = map(int, input().split())
k = int(input())
dp = [0] * ((n + 1) * m + k)
for i in range(1, n * m - k + 1):
    dp[i] = min(dp[i - 1] + d, dp[i - n] + c)
print(dp[n * m - k])