Go: package main

import (
	"fmt"
	"math"
)

func price(wantNum int, setNum int, setPrice int) int {
	return int(math.Ceil(float64(wantNum)/float64(setNum))) * setPrice
}

func min(a int, b int) int {
	if a < b {
		return a
	}
	return b
}

func main() {
	var n, a, b, c, d int
	fmt.Scanf("%d %d %d %d %d", &n, &a, &b, &c, &d)

	var priceA = price(n, a, b)
	var priceB = price(n, c, d)
	var p = min(priceA, priceB)

	fmt.Printf("%d\n", p)
}

Python: inputed_str = input()
str_list = inputed_str.split(' ')
data = [int(i) for i in str_list]
target = data[0]
def how_much(a, b):
    sumnum = 0
    summoney = 0
    while sumnum < target:
        sumnum += a
        summoney += b 
    return summoney

x = how_much(data[1], data[2])
y = how_much(data[3], data[4])
print(min(x, y))

Python: n, a, b, c, d = map(int, input().split())
# まずa本セットの方でいくらで買うことができるか確認する
if n % a == 0:
    s = n // a
else:
    s = n // a + 1
moneyA = s * b
# c本セットの方の値段も調べる
if n % c == 0:
    s = n // c
else:
    s = n // c + 1
moneyB = s * d
if moneyA <= moneyB:
    print(moneyA)
else:
    print(moneyB)

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

Python: inta = input().split(" ")
int_list = [int(a) for a in inta]
num1 = int_list[0] // int_list[1]
num2 = int_list[0] // int_list[3]
if int_list[0] % int_list[1] == 0:
    m = 1
if int_list[0] % int_list[3] == 0:
    m = 2
if int_list[0] % int_list[1] != 0:
    num1 += 1
if int_list[0] % int_list[3] != 0:
    num2 += 1
num1 *= int_list[2]
num2 *= int_list[4]
if num1 >= num2:
    print(num2)
elif num1 <= num2:
    print(num1)

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

for i in range(1,N):
    if A*i<N:
        continue
    else:
        E=i
        break

for j in range(1,N):
    if C*j<N:
        continue
    else:
        F=j
        break

if E*B<F*D:
    print(E*B)
else:
    print(F*D)

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

na=(n//a)*b if n%a==0 else (n//a+1)*b
nc=(n//c)*d if n%c==0 else (n//c+1)*d
print(min(na,nc))

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

Python: n,a,b,c,d=map(int,input().split())
s=n//a
t=n//c
if n%a!=0:
    C=s+1
else:
    C=s
if n%c!=0:
    D=t+1
else:
    D=t
X=C*b
Y=D*d
if X<=Y:
    print(X)
else:
    print(Y)

Python: n,a,b,c,d = map(int,input().split())
print(min(((n-1)//a+1)*b,((n-1)//c+1)*d))

Python: n,a,b,c,d=map(int,input().split())
A=(n+a-1)//a*b
B=(n+c-1)//c*d
print(min(A,B))

Python: nums = [int(n) for n in input().split()]
values = []
for i in range(2):
    n_a = nums[0] // nums[1 + 2 * i]
    n_b = nums[0] % nums[1 + 2 * i]
    if n_b == 0:
        values.append(n_a * nums[2 + 2 * i])
    else:
        values.append((n_a + 1) * nums[2 + 2 * i])

print(min(values))

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)

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: 
def updiv(a,b):

    if a % b == 0:
        return a //b
    else:
        return a // b + 1

N,A,B,C,D = map(int,input().split())
ans = float("inf")



print (min(updiv(N,A) * B,updiv(N,C) * D))

Python: n,a,b,c,d=map(int,input().split())
print(min((n+a-1)//a*b,(n+c-1)//c*d))

Python: import math
N,A,B,C,D = map(int,input().split())
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: n,a,b,c,d=map(int,input().split())
i=n//a
j=n//c
if n%a==0:
    pass
else:
    i+=1
if n%c==0:
    pass
else:
    j+=1
x=b*i
y=d*j
if x<=y:
    print(x)
else:
    print(y)

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

if x<=y: print(x)
else:    print(y)

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

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

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 + (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())
set1=B*-(-N//A)
set2=D*-(-N//C)
if set1<=set2 :
    print(set1)
else:
    print(set2)

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

p = N%A
q = N%C
r = N//A
s = N//C

if p == 0 and q == 0:
    t = B * r
    u = D * s
    if t > u:
        print(u)
    else:
        print(t)
elif p !=0 and q == 0:
    t = B * (r+1)
    u = D * s
    if t > u:
        print(u)
    else:
        print(t)
elif p == 0 and q != 0:
    t = B * r
    u = D * (s+1)
    if t > u:
        print(u)
    else:
        print(t)
else:
    t = B * (r+1)
    u = D * (s+1)
    if t > u:
        print(u)
    else:
        print(t)

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

X = N//A + (N%A!=0)
Y = N//C + (N%C!=0)

if(X*B < Y*D):
    print(X*B)
else:
    print(Y*D)

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)

Python: line = input().split(' ')
neccessary = int(line[0])
itemA =int(line[1])
numA = 0
if neccessary % itemA == 0:
    numA = neccessary // itemA
else:
    numA = neccessary // itemA + 1
priceA = int(line[2])
itemB =int(line[3])
numB = 0
if neccessary % itemB == 0:
    numB = neccessary // itemB
else:
    numB = neccessary // itemB + 1
priceB = int(line[4])
price1 = priceA * numA
price2 = priceB * numB
print(min(price1,price2))

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

if (N+A-1)//A*B < (N+C-1)//C*D:
    print((N+A-1)//A*B)
else:
    print((N+C-1)//C*D)

Python: n,a,b,c,d = map(int,input().split())
import math
x = math.ceil(n/a)
y = math.ceil(n/c)
price1 = x*b
price2 = y*d
if price1<=price2:
    print(price1)
else:
    print(price2)

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

if N%A==0:
    a=N//A*B
else:
    a=(N//A+1)*B
    
if N%C==0:
    b=N//C*D
else:   
    b=(N//C+1)*D

print(min(a,b))

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

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

if x<y:
    print(x)
else:
    print(y)

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

x=N//A
if N%A>0:
    x=x+1
    
y=N//C
if N%C>0:
    y=y+1

if x*B<=y*D:
    print(x*B)
else:
    print(y*D)

Python: s = list(map(int, input().strip().split(' ')))
a = s[0]
b = s[0]
i = 0
j = 0

while a >= 0:
    a -= s[1]
    i += 1

while b >= 0:
    b -= s[3]
    j += 1

c = s[2] * i
d = s[4] * j

if c > d:
    print(d)
else:
    print(c)

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
    
if x>y:
    print(y)
else:
    print(x)

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) 
    if (zan < 0):
        zan = 0
    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:
    x_1 = N // A
else:
    x_1 = N // A + 1
x_2 = x_1 * B

if N % C == 0:
    y_1 = N // C
else:
    y_1 = N // C + 1
y_2 = y_1 * D

if x_2 > y_2:
    print(y_2)
else:
    print(x_2)

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

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