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

C++: #include<stdio.h>
#include<math.h>
int main(void){
    int N,A,B,C,D;
    scanf("%d%d%d%d%d",&N,&A,&B,&C,&D);
    double x=ceil(N/A);
    double y=ceil(N/C);
    if (B*x <= D*y)
{printf("B*x");}
else{printf("D*y");}
return 0;
}

C++: #include<iostream>
using namespace std;
int N,A,B,C,D,X,Y,E,F;

int main(){
cin>>N>>A>>B>>C>>D;
E=N/A;
if(E*A<N){
E+=1;
}
X=B*E;
F=N/C;
if(F*C<N){
F+=1;
}
Y=D*F;
if(X<Y){
    cout<<X<<endl;
}else{
    cout<<Y<<endl;
}
}

C++: #include <iostream>
#include <algorithm>
int main() {

	int N, A, B, C, D, E, F;

	std::cin >> N >> A >> B >> C >> D;

	if (N % A == 0) {
		E = N / A * B;
	}
	else {
		E = (N / A + 1)*B;
	}
	if (N % C == 0) {
		F = N / C * D;
	}
	else {
		F = (N / C + 1)* D;
	}
	std::cout << std::min({ E, F }) << std::endl;

	return 0;

}

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

C++: #include <iostream>
using namespace std;
int main(){
    int num,num2,num3,num4,num5,sum,sum2;
    cin >> num >> num2 >> num3 >> num4 >> num5;
    if(num%num2!=0){
        sum=(num/num2)+1;
    }
    else{
        sum=num/num2;
    }
    sum=sum*num3;

    if(num%num4!=0){
        sum2=(num/num4)+1;
    }
    else{
        sum2=num/num4;
    }
    sum2=sum2*num5;

    if(sum>sum2){
        cout << sum2 << endl;
    }
    else if(sum<sum2){
        cout << sum << endl;
    }
    else{
        cout << sum << endl;
    }
    return 0;
}

C++: #include <iostream>

using namespace std;

int main()
{
    int N, A, B, C, D;
    cin >> N >> A >> B >> C >> D;
    int ans1, ans2;

    if(N%A==0) {
        ans1=(N/A)*B;
    } else {
        ans1=(N/A+1)*B;
    }
    if(N%C==0){
        ans2=(N/C)*D;
    } else {
        ans2=(N/C+1)*D;
    }
    if(ans1<ans2) {
        cout << ans1 << endl;
    } else {
        cout << ans2 << endl;
    }
    return 0;
}

C++: #include<stdio.h>
int main(void)
{
	int n,a,b,c,d,m,l,x,y,x1,y1,x2,y2;
	scanf("%d %d %d %d %d",&n,&a,&b,&c,&d);
	x1=n/a;
	y1=n/c;
	m=n%a;
	l=n%c;
	if(m>=1){
		x2=x1+1;
		x=b*x2;
	}
	else{
		x=x1*b;
		}
	if(l>=1){
		y2=y1+1;
		y=y2*d;
	}
	else{
		y=y1*d;
	}
	if(x<y){
		printf("%d\n",x);
	}
	else{
		printf("%d\n",y);
	}
	return 0;
}

C++: #include<stdio.h>
#include<string.h>
int main(void)
{	
	int n,x,y,a,b,c,d;
	scanf("%d",&n);
	scanf("%d",&a);
	scanf("%d",&b);
	scanf("%d",&c);
	scanf("%d",&d);
	x=n/a*b;
	y=n/c*d;
	if(n/a>0){
		x=x+b;
	}
	if(n/c>0){
		y=y+d;
	}
	if(x<y){
		printf("%d\n",x);
	}
	else{
		printf("%d\n",y);
	}
	
	return 0;
}

C++: #include <iostream>
#include <algorithm>
int main() {
	int A, B, C, D, N;
	std::cin >> N >> A >> B >> C >> D;
	int X = (N / A + 1) * B;
	int	Y = (N / C + 1) * D;
	if (N % A > 0) {
	}
	else {
		X -= B;
	}
	if (N % C > 0) {
	}
	else {
		Y -= D;
	}
	std::cout << std::min(X,Y) << std::endl;
	return 0;
}

C++: #include <iostream>
#include <algorithm>
using namespace std;
int n,a,b,c,d;
int main(void){
    cin>>n>>a>>b>>c>>d;
    cout<<min((n+a-1)/a*b,(n+c-1)/c*d)<<endl;
    
}

C++: #include<bits/stdc++.h>
using namespace std;

int main() {
    int n, a, b, c, d;
    cin >> n >> a >> b >> c >> d;
    printf("%d\n", ((n+(a-1))/a)*b < ((n+(c-1))/c)*d ? ((n+(a-1))/a)*b : ((n+(c-1))/c)*d);
    return 0;
}

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

C++: #include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

int main(){
    int n,a,b,c,d;
    cin >>n >>a >>b >>c >>d;

    int x = (n+a-1)/a, y = (n+c-1)/c;
    cout << min(b*x, d*y) << endl;
    return 0;
}

C++: #include<iostream>
using namespace std;
int main(void){
    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;
}

C++: #include<iostream>
using namespace std;

int min( int a, int b )
{
    return a < b ? a : b;
}

int main()
{
    int n, a, b, c, d;

    cin >> n >> a >> b >> c >> d;

    a = n % a == 0 ? n / a * b : ( n / a + 1 ) * b;
    c = n % c == 0 ? n / c * d : ( n / c + 1 ) * d;
    
    cout << min( a, c ) << endl;

    return 0;
}

C++: #include <iostream>
#include <algorithm>
using namespace std;

int main() {
  int N, A, B, C, D;
  cin >> N >> A >> B >> C >> D;
  int ans = min((N + A - 1) / A * B, (N + C - 1) / C * D);
  cout << ans << endl;
  return 0;
}

C++: #include <iostream>
#include <algorithm>
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 <cmath>
#include <algorithm>
using namespace std;
int main(){
    int N,A,B,C,D,a,c;
    cin>>N>>A>>B>>C>>D;
    a=ceil((double)N/A)*B;
    c=ceil((double)N/C)*D;
    cout<<min(a,c)<<endl;
    return 0;
}

C++: #include <iostream>
#include <math.h>
#include <algorithm>

using namespace std;

int main(){
  double n,a,b,c,d;cin>>n>>a>>b>>c>>d;
  cout<<min(ceil(n/a)*b,ceil(n/c)*d)<<endl;
}

C++: #include <iostream>
using namespace std;

int main() {
	int N, A, B, C, D;
	cin >> N >> A >> B >> C >> D;

	int setX, setY;
	if (N%A > 0) {
		setX = B * (N / A + 1);
	}
	else {
		setX = B * N / A;
	}
	if (N%C > 0) {
		setY = D * (N / C + 1);
	}
	else {
		setY = D * N / C;
	}

	if (setX > setY) {
		cout << setY << endl;
	}
	else if (setX < setY) {
		cout << setX << endl;
	}
	else {
		cout << setX << endl;
	}

	return 0;
}

C++: #include <iostream>
using namespace std;
int main(void){
    int n,a,b,c,d;
    int x,y;
    cin >> n,a,b,c,d;
    
    x=n/a;
    if(x!=0) x++;
    x=x*c;

    y=n/b;
    if(y!=0) y++;
    y=y*d;

    if(x<y){
     cout << x ;
    }else{
     cout << y ;
    }

return 0;
    
}

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

C++: #include <iostream>
using namespace std;
int main(void){
	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;
}