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

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

C++: #include<iostream>
#include<stdio.h>
#include<string>
#include <algorithm>
#include<cstring>
#include <math.h>
#include <iomanip>
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+1)*b);
  }else
    x=n/a*b;
  if(n%c!=0){
    y=((n/c+1)*d);
  }else
    y=n/c*d;

  if(x>y)
    cout<<y<<endl;
  else
    cout<<x<<endl;
  return 0;
}

C++: #include<iostream>
#include<stdio.h>

using namespace std;

int main(){
	int n, a, b, c, d;
	int ans;
	cin >> n >> a >> b >> c >> d;
	for (int i = 0;i<=n; i++){
		if (i*a >= n){
			ans = i*b;
			break;
		}
	}
	for (int j = 0; j <= n; j++){
		if (j*c >= n){
			if (ans > j*d){
				ans = j*d;
				break;
			}
		}
	}
	cout << ans << endl;
	return 0;
}

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

int main()
{
    int N,A,B,C,D;
    cin >> N >> A >> B >> C >> D;
    int a,b = 0;
    if(N % A == 0){
        a = (N - N % A) / A;
    } else {
        a = (N - N % A) / A + 1;
    }
    if(N % C == 0){
        b = (N - N % C) / C;
    } else {
        b = (N - N % C) / C + 1;
    }
    if(a * B < b * D){
        cout << a * B << endl;
    } else {
        cout << b * D << endl;
    }
    
    return 0;
 
}

C++: #include <iostream>

using namespace std;

int main()
{
	int  n, a, b, c, d, a1, a2;
	cin >> n >> a >> b >> c >> d;
	a1 = b * ((n / a) + 1);
	if (n%a == 0)
	{
		a1 -= b;
	}
	a2 = d * ((n / c) + 1);
	if (n%c == 0)
	{
		a2 -= d;
	}
	if (a1 < a2)
	{
		cout << a1 << endl;
	}
	else
		cout << a2 << endl;
		
	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;
	int valueX;
	int valueY;

	if(n%a == 0){
		x = n/a;	
	}
	else{
		x = n/a + 1;
	}

	if(n%c == 0){
		y = n/c;
	}
	else{
		y = n/c +1;
	}

	valueX = x*b;
	valueY = y*d;

	if(valueX <= valueY){
		cout << valueX << endl;
	}
	else{
		cout << valueY << endl;
	}



	return 0;
}

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


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

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

  if(N%A == 0){
  min = N/A * B;
  }
  else {
    min = (N/A + 1) * B;
  }

  if(N%C == 0){
    if(min > N/C*D){
      min = N/C * D;
    }
  }
  else {
    if(min > (N/C + 1) * D){
      min = (N/C + 1) * D;
    }
  }

  
  cout << min << endl;
  return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
int kai(int n) {
	if (n == 0) {
		return 1;
	}
	else {
		return n * kai(n - 1);
	}
}
int he(int a, int b) {
	return a * 3 + b;
}
int main() {
	int n = 9;
	vector<vector<int>> hyo(n,vector<int> (n));
	vector<vector<int>> qhyo;
	int uni = -1;
	vector<int> mju0((n - 1) / 2);
	vector<int> mju1((n - 1) / 2);
	int ans = 15;
	for (int i = 1; 2 * i < n; i++) {
		mju0[i - 1] = i; mju1[i - 1] = i + ((n - 1) / 2);
	}
	vector<int> ju0((n - 1) / 2);
	vector<int> ju1((n - 1) / 2);
	ju0 = mju0;
	ju1 = mju1;
	vector<int> jan = {253164479,253189607,252163902,252964761,227495855,253083033,227006135,227403253,227801299,228187986,228482510,227004074,227273433,165328076,164579227};
	int type;
	cout << "type" << "はいくつ";
	cin >> type;
	vector<vector<int>> cy(11,vector<int> (11));
	for (int i = 0; i < 11; i++) {
		cy[i][i] = 0;
		for (int j = (i + 1) % 11; j != i; j = (j + 1) % 11) {
			if ((j - i + 11) % 11 <= 5) {
				cy[i][j] = 1;
			}
			else {
				cy[i][j] = -1;
			}
		}
	}
	while (type != -1) {
		uni = -1;
		if (type == 0) {
			int c, d;
			cout << "c,d"<<"はいくつ";
			cin >> c >> d;//2 3->2,2 6->13,(7 3,7 6)-> 14
			for (int i = 0; i < n; i++) {
				for (int j = 0; j < n; j++) {
					vector<int> v(9);
					int x = (i - j + 9) % 9;
					if (x == 1 or x == 4 or x == c or x == d) {
						hyo[i][j] = -1;
					}
					else if (x == 0) {
						hyo[i][j] = 0;
					}
					else {
						hyo[i][j] = 1;
					}
				}
			}
		}
		if (type == 1) {
			for (int i = 0; i < 3; i++) {
				for (int j = 0; j < 3; j++) {
					vector<int> v(9);//14
					for (int k = 0; k < 3; k++) {
						v[he((i + 1) % 3, k)] = 1;
						v[he((i + 2) % 3, k)] = -1;
					}
					v[he(i, j)] = 0;
					v[he(i, (j+ 1) % 3)] = 1;
					v[he(i, (j + 2) % 3)] = -1;
					hyo[he(i, j)] = v;
				}
			}
		}
		if (type == 2) {
			int c, d;
			cout << "c,d" << "はいくつ";
			cin >> c >> d;
			vector<int> ji(11);
			ji[0] = 0; ji[c] = 0; ji[d] = 0;
			int th = 1;
			for (int i = 1; i < 11; i++) {
				if (i != c and i != d) {
					ji[i] = th;
					th++;
				}
			}
			hyo[0][0] = 0;
			for (int i = 0; i < 11; i++) {
				if (ji[i] != 0) {
					int xx = cy[i][0] + cy[i][c] + cy[i][d];
					if (abs(xx) == 3) {
						uni = 100;
					}
					else {
						hyo[ji[i]][0] = xx;
						hyo[0][ji[i]] = -xx;
					}
					for (int j = 0; j < 11; j++) {
						if (ji[j] != 0) {
							hyo[ji[i]][ji[j]] = cy[i][j];
						}
					}2
				}
			}
		}
		for (int ty = 0; ty < n and uni < 0; ty++) {
			if (ty == 0) {
				qhyo = hyo;
			}
			vector<int> ti1((n - 1) / 2);
			vector<int> ti2((n - 1) / 2);
			int xy = 0;
			int xz = 0;
			for (int i = 0; i < n; i++) {
				if (qhyo[ty][i] == 1) {
					ti1[xy] = i;
					xy++;
				}
				else if (ty != i) {
					ti2[xz] = i;
					xz++;
				}
			}
			vector<int> ti(n, ty);
			for (int i = 1; i < n; i++) {
				if (2 * i < n) {
					ti[i] = ti1[i - 1];
				}
				else {
					ti[i] = ti2[i - ((n + 1) / 2)];
				}
			}
			for (int j = 0; j < n and uni<0; j++) {
				for (int k = 0; k < n; k++) {
					hyo[j][k] = qhyo[ti[j]][ti[k]];
				}
				for (int j = 0; j < kai((n - 1) / 2) and uni<0; j++) {
					for (int k = 0; k < kai((n - 1) / 2) and uni<0; 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 = 1; x < n; x++) {
							for (int y = x + 1; y < n; y++) {
								qkaz = qkaz * 2 + (((hyo[jun[x]][jun[y]]) + 1) / 2);
							}
						}
						for (int l = 0; l < ans; l++) {
							if (qkaz == jan[l]) {
								uni = l;
							}
						}
						next_permutation(ju1.begin(), ju1.end());
					}
					next_permutation(ju0.begin(), ju0.end());
				}
			}
			ju0 = mju0; ju1 = mju1;
		}
		cout << uni<<endl<<"typeはいくつ？";
		cin >> type;
	}
}

C++: #include <iostream>
#include <algorithm>
#include <cstdio>
#include <string>
#include <cstring>
#include <vector>
#include <utility>
#include <functional>
#include <cmath>
#include <map>
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;

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>
using namespace std;
int main(){
int n,a,b,c,d;
cin >> n >> a >> b >> c >> d;
if (n%a==0,n%c==0){
	if(n/a*b>=n/c*d){
		cout << n/a*b <<endl;
}
	else cout << n/c*d <<endl;
if (n%a==0,n%c!=0){
	if(n/a*b>=(n/c+1)*d){
		cout << n/a*b <<endl;
}
	else cout << (n/c+1)*d <<endl;
if (n%a!=0,n%c!=0){
	if((n/a+1)*b>=(n/c+1)*d){
		cout << (n/a+1)*b <<endl;
}
	else cout << (n/c+1)*d <<endl;
if (n%a!=0,n%c==0){
	if((n/a+1)*b>=n/c*d){
		cout << (n/a+1)*b <<endl;
}
	else cout << n/c*d <<endl;
}
}
}
}
return 0;
}