Go: package main

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

var scanner = bufio.NewScanner(os.Stdin)

func nextString() string {
	scanner.Scan()
	return scanner.Text()
}

func nextInt() (int, error) {
	return strconv.Atoi(nextString())
}

func nextFloat64() (float64, error) {
	return strconv.ParseFloat(nextString(), 64)
}

func stringifyArray(arr []int) string {
	return strings.TrimRight(fmt.Sprintf("%+v", arr)[1:], "]")
}

func min(x, y int) int {
	if x < y {
		return x
	}
	return y
}
func main() {
	scanner.Split(bufio.ScanWords)

	n, _ := nextInt()
	a, _ := nextInt()
	b, _ := nextInt()
	c, _ := nextInt()
	d, _ := nextInt()

	costX := b * int(math.Ceil(float64(n)/float64(a)))
	costY := d * int(math.Ceil(float64(n)/float64(c)))
	fmt.Println(min(costX, costY))
}

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

print(min(math.ceil(N/A)*B,math.ceil(N/C)*D))

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

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

a = N/A
x = math.ceil(a)
X = x*B

c = N/C
y = math.ceil(c)
Y = y*D

if (X > Y):
    print(Y)
else:
    print(X)

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

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

Python: n,a,b,c,d=map(int,input().split())
num1=0
sum1=0
num2=0
sum2=0
while num1<n:
    num1+=a
    sum1+=b
while num2<n:
    num2+=c
    sum2+=d
    
if sum1<=sum2:
    print(sum1)
else:
    print(sum2)

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/A)*B)
else:
    print(math.ceil(N/C)*D)

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

price_x = 0
num_x = 0
price_y = 0
num_y = 0
while True:
    if num_x >= N:
        break
    num_x = num_x + A
    price_x = price_x + B
while True:
    if num_y >= N:
        break    
    num_y = num_y + C
    price_y = price_y + D

print(min(price_x,price_y))

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

index = 1
answer = 1000 * 1000 * 1000
while True:
    # 必要なセット数を算出(切り上げ)
    needs = -((-1 * inp_line[0]) // inp_line[index])
    answer = min(answer, (needs * inp_line[index + 1]))

    index += 2
    if index + 1 > len(inp_line):
        break

print(answer)

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
ans = min(x * b, y * d)
print(ans)

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))