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

Python: n,a,b,c,d=map(int,input().split())
array=[]
if n%a!=0:
    array+=[(n//a+1)*b]
else:array+=[int((n/a)*b)]
if n%c!=0:
    array+=[(n//c+1)*d]
else:array+=[int((n/c)*d)]
print(min(array))

Python: n = input().split()

total = 0

min = 0
x = 0
y = 0
x_total = 0
y_total = 0


while(x < int(n[0])):
    #if(x <= int(n[0])):

    x += int(n[1])
    x_total += int(n[2])
    #print(x_total)
    #if(y <= int(n[0])):
while(y < int(n[0])):
    y += int(n[3])
    y_total += int(n[4])
    #print(y_total)

if(x_total < y_total):
    print(x_total)
else:
    print(y_total)

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
    
a=x*B
b=y*D

if a==b:
    print(a)
    
else:
    print(min(a,b))

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

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:
    c=int(n/C)
else:
    c=int(n/C)+1

if a*b>c*d:
    print(int(c*d))
else:
    print(int(a*b))

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
N, A, B, C, D = map(int, input().split(' '))
# 10 3 100 5 180


a_count = math.ceil(N/A)
c_count = math.ceil(N/C)

a_cost = a_count * B
c_cost = c_count * D

print(min([a_cost, c_cost]))

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
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 -*-
"""
Pencils
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0641

"""
import sys


def solve(N, A, B, C, D):
    q1, r1 = divmod(N, A)
    ans1 = B * (q1 + (r1 > 0))
    q2, r2 = divmod(N, C)
    ans2 = D * (q2 + (r2 > 0))
    return min(ans1, ans2)


def main(args):
    N, A, B, C, D = map(int, input().split())
    ans = solve(N, A, B, C, D)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])

Python: # coding: utf-8
# Your code here!
N,A,B,C,D=map(int,input().split())

if N%A==0 and N%C==0:
    X=(N//A)*B
    Y=(N//C)*D
    
    X,Y=sorted([X,Y])
    print(X)

elif N%A==0 and N%C!=0:
    X=(N//A)*B
    Y=((N//C)+1)*D
    
    X,Y=sorted([X,Y])
    print(X)

elif N%A!=0 and N%C==0:
    X=((N//A)+1)*B
    Y=(N//C)*D
    
    X,Y=sorted([X,Y])
    print(X)

else:
    X=((N//A)+1)*B
    Y=((N//C)+1)*D
    
    X,Y=sorted([X,Y])
    print(X)

Python: #!/usr/bin/python3

import os
import sys


def main():
    N, A, B, C, D = read_ints()
    print(solve(N, A, B, C, D))


def solve(N, A, B, C, D):
    return min((N + A - 1) // A * B, (N + C - 1) // C * D)


###############################################################################

DEBUG = 'DEBUG' in os.environ


def inp():
    return sys.stdin.readline().rstrip()


def read_int():
    return int(inp())


def read_ints():
    return [int(e) for e in inp().split()]


def dprint(*value, sep=' ', end='\n'):
    if DEBUG:
        print(*value, sep=sep, end=end)


if __name__ == '__main__':
    main()

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

X = -1*(-1 * n // a) * b
Y = -1*(-1 * n // c) * d

print(min(X, Y))

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

x=int((n+a-1)/a)
y=int((n+c-1)/c)

if x*b < y*d:
    print(x*b)
else:
    print(y*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: # AOJ Volume6 0652
# http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0641

import math

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

k1 = math.ceil(N / A)
k2 = math.ceil(N / C)

m1 = B * k1
m2 = D * k2
print(min(m1, m2))

Python: a,b,c,d,e=map(int,input().split())
f=a%b
g=a%d
if f==0:
    h=c*(a//b)
else:
    h=c*((a//b)+1)
if g==0:
    i=e*(a//d)
else:
    i=e*((a//d)+1)

print(min(h,i))

Python: import math
N, A, B, C, D=map(int,input().split())
x=math.ceil(N/A)
y=x*B
z=math.ceil(N/C)
r=z*D
print(min(y,r))

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

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())
print(min((N+A-1)//A*B,(N+C-1)//C*D))

Python: def find_cost(n, a, b):
    if n % a == 0:
        return b * (n // a)
    else:
        return b * ((n // a) + 1)

n, a, b, c, d = map(lambda x: int(x), input().split(" "))
ans = 1e9
ans = min(ans, find_cost(n, a, b))
ans = min(ans, find_cost(n, c, d))
print(ans)

Python: # -*- coding: utf-8 -*-
N,A,B,C,D = map(int,input().split())

pencilsX = 0
ansX = 0
while True:
    pencilsX += A
    ansX += B
    if pencilsX >= N:
        break

pencilsY = 0
ansY = 0
while True:
    pencilsY += C
    ansY += D
    if pencilsY >= N:
        break

print(min(ansX, ansY))

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

aa=int((N+a-1)/a)
bb=int((N+c-1)/c)

cc=aa*b
dd=bb*d

if cc>dd :
    print(dd)

else :
    print(cc)

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

if y==N/C:
    Y=N//C
else:
    Y=N//C+1

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

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

xpen=0
xmoney=0
ypen=0
ymoney=0

while(xpen<n):
    xpen=xpen+a
    xmoney=xmoney+b
while(ypen<n):
    ypen=ypen+c
    ymoney=ymoney+d

if(xmoney>ymoney):
    print(ymoney)
else:
    print(xmoney)

Python: N,A,B,C,D =input().split()
if (int(N)%int(A))>0 : X = ((int(N)//int(A))+1)*int(B)
else : X = (int(N)//int(A))*int(B)
if (int(N)%int(C))>0 : Y = ((int(N)//int(C))+1)*int(D)
else : Y = (int(N)//int(C))*int(D)
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
else:
    x=N//A+1
if N%C==0:
    y=N//C
else:
    y=N//C+1
print(min(x*B,y*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 as m
N,A,B,C,D=(float(x) for x in input().split())

a=m.ceil(N/A)*B
b=m.ceil(N/C)*D

if a>b:
    print(int(b))
else:
    print(int(a))

Python: import math
a = input().split()
n = int(a[0])
A = int(a[1])
b = int(a[2])
c = int(a[3])
d = int(a[4])
seta = math.ceil(n / A)
setc = math.ceil(n / c)
costa = seta * b
costb = setc * d
if costa < costb:
    print(costa)
elif costb < costa:
    print(costb)
else:
    print(costa)

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)

C++: #include <bits/stdc++.h>
using namespace std;
int main(){
  int N,A,B,C,D;
  cin>>N>>A>>B>>C>>D;
  cout<<min((N+A-1)/A*B,(N+C-1)/C*D)<<endl;
  return 0;
}

C++: #include <iostream>
#include <algorithm>
using namespace std;
int main() {
	int n, a, b, c, d;
	int xnum = 0, ynum = 0;
	cin >> n >> a >> b >> c >> d;
	if (n%a) xnum = (n / a) + 1;
	else xnum = n / a;
	if (n%c) ynum = (n / c) + 1;
	else ynum = n / c;
	cout << min(xnum*b, ynum*d) << endl;
}