Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func nextInt() int {
	sc.Scan()
	n, _ := strconv.Atoi(sc.Text())
	return n
}

func main() {
	sc.Split(bufio.ScanWords)
	N, A, B, C, D := nextInt(), nextInt(), nextInt(), nextInt(), nextInt()

	x := (N + A - 1) / A * B
	y := (N + C - 1) / C * D

	var z int
	if x < y {
		z = x
	} else {
		z = y
	}

	fmt.Println(z)
}

Python: a,b,c,d,e=input().split()
a=int(a)
b=int(b)
c=int(c)
d=int(d)
e=int(e)
x=a//b+(a%b!=0)*1
y=a//d+(a%d!=0)*1
print(min(x*c,y*e))

Python: import math
n, a, b, c, d = map(int, input().split())
print(min(math.ceil(n / a) * b, math.ceil(n / c) * d))

Python: import math

args = [int(x) for x in input().split()]

ans = [math.ceil(args[0]/args[1])*args[2], math.ceil(args[0]/args[3])*args[4]]

print(min(ans))

Python: N,A,B,C,D = map(int,input().split())
print(min((N+A-1)//A*B, (N+C-1)//C*D))

Python: N,A,B,C,D=map(int,input().split())
i=1
j=1
while True:
    if A*i>=N:
        E=i*B
        break
    i=i+1
while True:
    if C*j>=N:
        F=j*D
        break
    j=j+1
print(min(E,F))

Python: N,A,B,C,D=map(int,input().split())
import math
a=N/A
b=B*math.ceil(a)
c=N/C
d=D*math.ceil(c)
if b>d:
     print(d)
else:
     print(b)

Python: N,A,B,C,D=map(int,input().split())
x=(N+A-1)//A
y=(N+C-1)//C
X=x*B
Y=y*D
if X<=Y:
    print(X)
else:
    print(Y)

Python: # coding: utf-8
# Your code here!

N, A, B, C, D = map(int, input().split())

if (A <= N or C <= N):
   if N % A == 0:
      X = int(N / A) * B
   else:
      X = int(N / A + 1) * B
   if N % C == 0:
      Y = int(N / C) * D
   else:
      Y = int(N / C + 1) * D
else:
   X = B
   Y = D
   
if X <= Y:
   print(int(X))
else:
   print(int(Y))

Python: N,A,B,C,D = map(int,input().split())
if N % A == 0 :
  a = N // A
else:
  a = (N // A) + 1
if N % C == 0:
  c = N // C
else:
  c = (N // C) + 1
x = a*B
y = c*D
if x <= y:
  print(x)
else:
  print(y)

Python: N,A,B,C,D=map(int,input().split())

if N%A==0:
    X=B*(N//A)
else:
    X=B*((N//A)+1)

if N%C==0:
    Y=D*(N//C)
else:
    Y=D*((N//C)+1)
    
if X>=Y:
    print(Y)
else:
    print(X)

Python: N,a,b,c,d=map(int,input().split())

def fprice(n,p):
    count=0
    price=0
    while N>count:
        count+=n
        price+=p
    return price
if fprice(a,b)>=fprice(c,d):
    print(fprice(c,d))
else:
    print(fprice(a,b))

Python: N,A,B,C,D=map(int,input().split())
print(min(-(-N//A)*B,-(-N//C)*D))

Python: import math

N,A,B,C,D=map(int,input().split())

if B*math.ceil(N/A)>D*math.ceil(N/C):
    print(D*math.ceil(N/C))
elif B*math.ceil(N/A)<D*math.ceil(N/C):
    print(B*math.ceil(N/A))
else:
    print(B*math.ceil(N/A))

Python: import math

n,a,b,c,d=map(int,input().split())

print(min((math.ceil(n/a))*b,(math.ceil(n/c))*d))

Python: N,A,B,C,D=map(int,input().split())
x=N//A
y=N//C
if N<=A*x:
    if N<=C*y:
        if B*x<=D*y:
            print(B*x)
        else:
            print(D*y)
    else:
        if B*x<=D*(y+1):
            print(B*x)
        else:
            print(D*(y+1))
else:
    if N<=C*y:
        if B*(x+1)<=D*y:
            print(B*(x+1))
        else:
            print(D*y)
    else:
        if B*(x+1)<=D*(y+1):
            print(B*(x+1))
        else:
            print(D*(y+1))

Python: N,A,B,C,D=map(int,input().split())
x=-(-N//A)*B
y=-(-N//C)*D
if x<y:
    print(x)
else:
    print(y)

Python: N, A, B, C, D = map(int, input().split())

arr = [[A, B],[C, D]]
result = []
for line in arr:
    cnt = 0
    chg = 0
    while N > cnt:
        cnt += line[0]
        chg += line[1]
    result.append(chg)

print(min(result))

Python: import math as m
N,A,B,C,D=map(int,input().split())
if (m.ceil(N/A))*B > (m.ceil(N/C))*D:
    print((m.ceil(N/C))*D)
else:
    print((m.ceil(N/A))*B)

Python: N,A,B,C,D=map(int,input().split())
if N%A==0:
    N1=N//A
else:
    N1=N//A+1

if N%C==0:
    N2=N//C
else:
    N2=N//C+1

if (N1*B)>=(N2*D):
    print(N2*D)
else:
    print(N1*B)

Python: N,A,B,C,D=map(int,input().split())
if N%A==0:
    X=(N//A)*B
else:
    X=(N//A+1)*B
if N%C==0:
    Y=(N//C)*D
else:
    Y=(N//C+1)*D
print(min(X,Y))

Python: import math

n, a, b, c, d = map(int, input().split())
print(min([math.ceil(n/a)*b, math.ceil(n/c)*d]))

Python: n, a, b, c, d = map(int, input().split())
if -(-n // a) * b > -(-n // c) * d:
	print(-(-n // c) * d)
else:
	print(-(-n // a) * b)

Python: N, A, B, C, D = map(int, input().split())
c1 = (N+A-1)//A
c2 = (N+C-1)//C
print(min(c1*B, c2*D))

Python: N , A , B , C , D =map(int,input().split())
x = N // A
y = N // C
if N % A == 0:
    a = x * B
else:
    a = B * (x + 1)

if N % C == 0:
    c = y * D
else:
    c = D * (y + 1)
    
if a < c:
    print(a)
else:
    print(c)

Python: N,A,B,C,D = map(int, input().split())
#XとYをセットの数とする
X = N//A
if N % A != 0: X+=1   # 割り切れなれば+1
Y = N//C
if N % C != 0: Y+=1   # 割り切れなれば+1
print(min(X*B, Y*D))

Python: N, A, B, C, D = [int(i) for i in input().split(" ")]

set1, set2 = 0, 0
set1_v, set2_v = 0, 0

while set1 < N:
    set1 += A
    set1_v += B

while set2 < N:
    set2 += C
    set2_v += D

print(min(set1_v, set2_v))

Python: N,A,B,C,D = map(int, input().split())
import math
n = math.ceil(N/A)*B
m = math.ceil(N/C)*D
if n <= m:
    print(n)
else:
    print(m)

Python: N,A,B,C,D= map(int,input().split())

x = N//A+(N%A!=0)*1
y = N//C+(N%C!=0)*1

print(min(x*B,y*D))

Python: N,A,B,C,D=map(int,input().split())
if N%A==0:
    X=(N//A)*B
else:
    X=(N//A)*B+B
if N%C==0:
    Y=(N//C)*D
else:
    Y=(N//C)*D+D
print(min(X,Y))

Python: n, a, b, c, d = map(int, input().split())
import math
h = math.floor((n+a-1)/a)*b
t = math.floor((n+c-1)/c)*d

if(h < t):
    print(h)
else:
    print(t)

Python: nabcd=list(map(int,input().split()))
n=nabcd[0]
a=nabcd[1]
b=nabcd[2]
c=nabcd[3]
d=nabcd[4]

if n%a!=0:
    x_set=int(n/a)+1
else:
    x_set=int(n/a)

if n%c!=0:
    y_set=int(n/c)+1
else:
    y_set=int(n/c)
x_goukei=x_set*b
y_goukei=y_set*d

if x_goukei<y_goukei:
    print(x_goukei)
else:
    print(y_goukei)

Python: N,A,B,C,D=(int(x) for x in input().split())

import math

if math.ceil(N/A)*B>math.ceil(N/C)*D:
    print(math.ceil(N/C)*D)
    
else:
    print(math.ceil(N/A)*B)

Python: data = list(map(int, input().split()))

buy = []

for i in range(2):
    if data[0] % data[2*i+1] == 0:
        buy.append(data[0] / data[2*i+1])
    else:
        buy.append(data[0] / data[2*i+1] + 1)

dataA = int(buy[0])*data[2]
dataB = int(buy[1])*data[4]

if dataA <= dataB:
    print(dataA)
else:
    print(dataB)

Python: 
try:
     (N,a,b,c,d)  =  map(int,input().split())
except:
    exit

cnt = 0
min_cost = 1000000

while ((cnt * a) <= (N + a-1)):
    a_setnum = cnt 
    zan = N - (a_setnum * a) 
    c_setnum = zan // c
    if ( zan % c != 0):
        c_setnum += 1
    cnt += 1
    cost =a_setnum * b + c_setnum *d
    if (min_cost > cost):
        min_cost = cost
print (min_cost)

Python: N,A,B,C,D=map(int,input().split())
if N%A==0 and N%C==0:
    if (N//A)*B < (N//C)*D:
        print((N//A)*B)
    else:
        print((N//C)*D)
elif N%A==0 and not N%C==0:
    if (N//A)*B < ((N//C)+1)*D:
        print((N//A)*B)
    else:
        print(((N//C)+1)*D)
elif not N%A==0 and  N%C==0:
    if ((N//A)+1)*B < (N//C)*D:
        print(((N//A)+1)*B)
    else:
        print((N//C)*D)
else:
    if ((N//A)+1)*B < ((N//C)+1)*D:
        print(((N//A)+1)*B)
    else:
        print(((N//C)+1)*D)

Python: # coding: utf-8
# Your code here!

N,A,B,C,D = map(int,input().split())

X = int(N/A)
Y = int(N/C)
KX = int()
KY = int()
if N%A==0:
   KX = X*B
   KY = (Y+1)*D
elif N%C==0:
    KX = (X+1)*B
    KY = Y*D
   
else:
    KX = (X+1)*B
    KY = (Y+1)*D

if KX>KY:
    print(KY)
else:
    print(KX)

Python: N,A,B,C,D=map(int,input().split())
if N%A:
    X=(N//A+1)*B
else:
    X=(N//A)*B
if N%C:
    Y=(N//C+1)*D
else:
    Y=(N//C)*D
if X<Y:
    print(X)
else:
    print(Y)