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<iostream>
#include<vector>
#include<algorithm>


using namespace std;

int main(){
    int N,A,B,C,D;
    scanf("%d%d%d%d%d",&N,&A,&B,&C,&D);

    int mA , mC;
    int pB=0, pD=0;
    for(int i=1; i<=1000;i++){
        mA = A*i;
        if(N<=mA){
            pB = i*B;
            break;
        }

    }
    for(int i=1; i<=1000;i++){
        mC = C*i;
        if(N<=mC){
            pD = i*D;
            break;
        }

    }
    if(pD > pB){
        printf("%d\n",pB);
    }
    else{
        printf("%d\n",pD);
    }
    return 0;
}

C++: #include <bits/stdc++.h>

using namespace std;

#define	MIN(X, Y)	X < Y ? X : Y

struct SET{
	int pen_n;
	int yen;
};

int main()
{
	int N;
	SET X, Y;
	int x_n, y_n;
	int ans;

	cin >> N >> X.pen_n >> X.yen >> Y.pen_n >> Y.yen;

	x_n = N / X.pen_n;
	if(N % X.pen_n)
		x_n++;

	y_n = N / Y.pen_n;
	if(N % Y.pen_n)
		y_n++;

	ans = MIN(x_n * X.yen, y_n * Y.yen);

	cout << ans << endl;

	return 0;
}

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++: // clang-format off
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = 3.14159265358979;
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
bool odd(const int &n) { return n & 1; }
bool even(const int &n) { return ~n & 1; }
template<typename T> int len(const T &v) { return v.size(); }
template<typename T = int> T in() { T x; cin >> x; return x; }
template<typename T = int> T in(T &&x) { T z(forward<T>(x)); cin >> z; return z; }
template<typename T> istream &operator>>(istream &is, vector<T> &v) { for (T &x : v) is >> x; return is; }
template<typename A, typename B> istream &operator>>(istream &is, pair<A, B> &p) { return is >> p.first >> p.second; }
template<typename T> ostream &operator<<(ostream &os, const vector<vector<T>> &v) { int n = v.size(); rep(i, n) os << v[i] << (i == n - 1 ? "" : "\n"); return os; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &v) { int n = v.size(); rep(i, n) os << v[i] << (i == n - 1 ? "" : " "); return os; }
template<typename A, typename B> ostream &operator<<(ostream &os, const pair<A, B> &p) { return os << p.first << ' ' << p.second; }
template<typename Head, typename Value> auto vectors(const Head &head, const Value &v) { return vector<Value>(head, v); }
template<typename Head, typename... Tail> auto vectors(Head x, Tail... tail) { auto inner = vectors(tail...); return vector<decltype(inner)>(x, inner); }
// clang-format on

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 "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T> V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> > Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T> mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }

/*
 <url:>
 問題文============================================================
 =================================================================
 解説=============================================================
 ================================================================
 */

ll solve(){
    ll N,A,B,C,D;
    cin >> N >> A >> B >> C >> D;
    return min((N+A-1)/A*B,(N+C-1)/C*D);
}
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    cout << solve() << endl;
    return 0;
}

C++: #include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int N, A, B, C, D; //A本でB円、C本でD円
    cin >> N >> A >> B >> C >> D;
    //X
    int m, money1;
    for(int i = 1;; i++){
        m = A * i;
        if(m >= N){
            //cout << B * i << endl;
            money1 = B * i;
            break;
        }
        
    }
    
    //Y
    int n, money2;
    for(int i = 1;; i++){
        n = C * i;
        if(n >= N){
            //cout << D * i << endl;
            money2 = D * i;
            break;
        }
    }
    if(money1 > money2) cout << money2 << endl;
    else cout << money1 << endl;
}

C++: #include <bits/stdc++.h>
#define rep(i,n)for(long long i=0;i<(n);i++)
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
const ll INF=1e18;
const ll MOD=1e9+7;
const double pi=acos(-1);
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);  
  
  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<bits/stdc++.h>
using namespace std;


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

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

  bool first_f = true;
  int kane = 0;
  int honsu = 0;
  for(int i=1; i<N/C + 1; ++i){
    int k;
    for(k=1; k<N/A + 1; ++k){
      honsu += A;
      kane += B;
      if(honsu >= N){
	if(first_f){
	  first_f = false;

	  min = kane;
	  cout << min << "*******" << endl;
	  break;
	}else{
	  if(min > kane){
	    min = kane;
	  cout << min << "*******" << endl;
	  }
	  break;
	}
      }
    }
    honsu -= k * A;
    honsu += C;
    kane -= k * B;
    kane += D;

    if(honsu >= N){
      if(min > kane){
        min = kane;
	  cout << min << "*******" << endl;
      }
      break;
    }
  }

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

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

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

int main() {
	int N, A, B, C, D, E = 0, F = 0;
	cin >> N >> A >> B >> C >> D;

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

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

	if (E > F) {
		cout << F << endl;
	}
	else {
		cout << E << endl;
	}

}