Go: package main

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

var sc = bufio.NewScanner(os.Stdin)

func nextInt() int {
	sc.Scan()
	n, _ := strconv.Atoi(sc.Text())
	return n
}

func main() {
	sc.Split(bufio.ScanWords)
	N, A, B, C, D := nextInt(), nextInt(), nextInt(), nextInt(), nextInt()

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

	var z int
	if x < y {
		z = x
	} else {
		z = y
	}

	fmt.Println(z)
}

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

C++: #include <iostream>
 
using namespace std;
 
int N,A,B,C,D;
int X_SET,Y_SET,X_SUM,Y_SUM;
int main(){
cin>>N>>A>>B>>C>>D;
X_SET = N/A;
if(N%A>0)X_SET=X_SET+1;
Y_SET=N/C;
if(N%C>0)Y_SET=Y_SET+1;
X_SUM=B*X_SET;
Y_SUM=D*Y_SET;
if(X_SUM<Y_SUM)cout<<X_SUM<<endl;
else
cout<<Y_SUM<<endl;
return 0;
}

C++: #include<vector>
#include<iostream>
#include<algorithm>
using namespace std;
int kai(int n) {
	if (n == 0) {
		return 1;
	}
	else {
		return n * kai(n - 1);
	}
}
int rui(int n) {
	if (n == 0) {
		return 1;
	}
	else {
		return 2 * rui(n - 1);
	}
}
int ord(int n) {
	if (n % 2 == 1) {
		return 0;
	}
	else {
		return 1 + ord(n / 2);
	}
}
int main() {
	int n; int ans = 0;
	cin >> n;
	if (n == 1) {
		cout << 0 << endl << 1;
	}
	else if (n == 3) {
		cout << "0 1 -1" << endl << "-1 0 1" << endl << "1 -1 0" << endl << 1;
	}
	else {
		vector<long long> ko(n);
		vector<vector<int>> hyo(n, vector<int>(n, 0));
		long long ba = 4 * n;
		vector<long long> rba(n);
		rba[0] = 1;
		for (int i = 1; i < n; i++) {
			rba[i] = rba[i - 1] * ba;
		}
		for (int i = 1; i < n; i++) {
			if (2 * i < n) {
				hyo[0][i] = 1;
				hyo[i][0] = -1;
			}
			else {
				hyo[0][i] = -1;
				hyo[i][0] = 1;
			}
			for (int j = i + 1; j < n; j++) {
				hyo[i][j] = 1;
				hyo[j][i] = -1;
			}
			ko[i] = n + 1 - 2 * i;
			if (ko[i] <= 0) {
				ko[i] -= 2;
			}
		}
		long long koin = 0;//koin <=ba no n jou//36no9jou
		for (int i = 0; i < n; i++) {
			koin += ko[i] * rba[i];
		}
		int bi = ((n - 1)*(n - 2)) / 2;
		vector<int> jit(bi);
		vector<int> jim(bi);
		int xx = 0;
		for (int i = 1; i < n; i++) {
			for (int j = i + 1; j < n; j++) {
				jit[xx] = i;
				jim[xx] = j;
				xx++;
			}
		}
		int cha;
		int chx;
		int chy;
		int jou = rui(bi);
		vector<long long> jan(rui(20));
		vector<int> zer(n, 0);
		vector<int> mju0((n - 1) / 2);
		vector<int> mju1((n - 1) / 2);
		for (int i = 1; 2 * i < n; i++) {
			mju0[i - 1] = i; mju1[i - 1] = i + ((n - 1) / 2);
		}
		vector<int> ju0 = mju0; vector<int> ju1 = mju1;
		for (int i = 1; i < jou; i++) {
			cha = ord(i);
			chx = jit[cha];
			chy = jim[cha];
			long long x = hyo[chx][chy];
			long long two = 2;
			koin -= x * two * rba[chx];
			koin += x * two * rba[chy];
			hyo[chx][chy] = -x;
			hyo[chy][chx] = x;
			if (koin == 0) {
				vector<vector<int> > qhyo;
				int uni = 1;
				long long kaz = 0;
				ju0 = mju0; ju1 = mju1;
				for (int j = 0; j < kai((n - 1) / 2) and uni == 1; j++) {
					for (int k = 0; k < kai((n - 1) / 2) and uni == 1; k++) {
						vector<int> jun(n, 0);
						for (int i = 1; i < n; i++) {
							if (2 * i < n) {
								jun[i] = ju0[i - 1];
							}
							else {
								jun[i] = ju1[i - (n + 1) / 2];
							}
						}
						long long qkaz = 0;
						for (int x = 0; x < n; x++) {
							for (int y = 0; y < n; y++) {
								qkaz = qkaz * 2 + (hyo[jun[x]][jun[y]]);
							}
						}
						if (j == 0 and k == 0) {
							kaz = qkaz;
						}
						for (int l = 0; l < ans; l++) {
							if (qkaz == jan[l]) {
								uni = 0;
							}
						}
						next_permutation(ju1.begin(), ju1.end());
					}
					next_permutation(ju0.begin(), ju0.end());
				}
				if (uni == 1) {
					jan[ans] = kaz;
					ans++;
				}
			}
		}
		cout << ans << endl;
		cin >> n;
	}
}

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

C++: #include <iostream>

int calculateMin(const int& N, const int& A, const int& B, const int& C, const int& D) {
	int ret;
	int x_price = B;
	int y_price = D;
	int total_x_price, total_y_price;

	int i = 0;
	do {
		i++;
		total_x_price = i*x_price;
	} while ( i*A < N);

	 i = 0;
	do {
		i++;
		total_y_price = i*y_price;
	} while (i*C < N);

	if (total_x_price < total_y_price)
	{
		ret = total_x_price;
	}
	else {
		ret = total_y_price;
	}
	return ret;
}

int main() {

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

	auto min = calculateMin(N, A, B, C, D);
	std::cout << min << std::endl;
	return 0;
}

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