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: N, A, B, C, D = map(int, input().split())

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

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

Python: N, A, B, C, D = map(int, input().split())
x = 0
y = 0
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())
q=math.ceil(n/a)*b
w=math.ceil(n/c)*d
print(min(q,w))

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())
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: N,A,B,C,D=map(int,input().split())
X=(N//A)*B
Y=(N//C)*D

if X==(N/A)*B and Y==(N/C)*D:
    if X<Y:
        print(X)
    else:
        print(Y)
elif X==(N/A)*B and Y!=(N/C)*D:
    if X<(Y+D):
        print(X)
    else:
        print(Y+D)
elif X!=(N/A)*B and Y==(N/C)*D:
    if X+B<Y:
        print(X+B)
    else:
        print(Y)
elif X!=(N/A)*B and Y!=(N/C)*D:
    if X+B<Y+D:
        print(X+B)
    else:
        print(Y+D)

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

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: 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=list(map(int,input().split()))
if N%A==0: p=N/A
else: p=N//A+1
if N%C==0: q=N/C
else: q=N//C+1
if B*p<D*q: print(int(B*p))
else: print(int(D*q))

Python: import math

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

X=(math.ceil(N/A))*B
Y=(math.ceil(N/C))*D

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

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

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

Python: import math
input_line = input().rstrip().split()
N = int(input_line[0])
A = int(input_line[1])
B = int(input_line[2])
C = int(input_line[3])
D = int(input_line[4])

x = math.ceil(N/A)
x_t = B * x 
y = math.ceil(N/C)
y_t = D * y

print(min(x_t, y_t))

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())
if n%a!=0:
    s=n//a+1
else:
    if n//a==0:
        s=n//a+1
    else:
        s=n//a
if n%c!=0:
    t=n//c+1
else:
    if n//c==0:
        t=n//c+1
    else:
        t=n//c
if b*s>d*t:
    print(d*t)
else:
    print(b*s)

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

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

print(min(X,Y))

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

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(X)
else:
    print(Y)

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

X=B*a
Y=D*b

if X<=Y:
    print(X)
else:
    print(Y)

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

Python: # coding: utf-8
from math import ceil
N,A,B,C,D = map(int,input().split())   #N A B C D
if ceil(N/A)*B > ceil(N/C)*D:
    print(ceil(N/C)*D)
elif ceil(N/C)*D > ceil(N/A)*B :
    print(ceil(N/A)*B)
else:
    print(ceil(N/A)*B)

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

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(max(x, y))

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

currentPen = 0
costA = 0
costB = 0
while (n > currentPen):
  costA += b
  currentPen += a

currentPen = 0
while(n > currentPen):
  costB += d
  currentPen += c

if (costA < costB):
  print(costA)
else:
  print(costB)

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

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

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

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

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

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

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

a=int(N//A)
c=int(N//C)
if N%A==0:
    a=a
else:
    a=a+1
if N%C==0:
    c=c
else:
    c=c+1
    

x=a*B
y=c*D

if x>=y:
    print(int(y))
else:
    print(int(x))

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)