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 <bits/stdc++.h>
#define dum(x) cout<<#x<<'='<<x<<endl
using namespace std;

int main() {
  int n, a, b, c, d;
  cin >> n >> a >> b >> c >> d;
  int setA = n / a;
  int setB = n / c;
  int pa, pb;
  if (n % a == 0) {
    pa = setA * b;
  } else {
    setA++;
    pa = setA * b;
  }
  if (n % c == 0) {
    pb = setB * d;
  } else {
    setB++;
    pb = setB * d;
  }
  cout << min(pa, pb) << endl;
}

C++: #include<stdio.h>
int main()
{
int N,A,B,C,D,hoge=0,sushi=0;
scanf("%d %d %d %d %d",&N,&A,&B,&C,&D);
if(N%A!=0){
hoge=N/A;
hoge=hoge+1;
}else{
hoge=N/A;
}
if(N%C!=0){
sushi=N/C;
sushi=sushi+1;
}else{
sushi=N/C;
}
B=hoge*B;
D=sushi*D;
if(B<=D){
printf("%d\n",B);
}else if(D<=B){
printf("%d\n",D);
}
return(0);
}

C++: #include<bits/stdc++.h>
using namespace std;
int main(){
  int n,a,b,c,d;
  cin>>n>>a>>b>>c>>d;
  if(n%a==0) a=n/a;
  else a=n/a+1;
  if(n%c==0) c=n/c;
  else c=n/c+1;
  if(a*b>c*d) cout<<c*d<<endl;
  else cout<<a*b<<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 moneyX = ( ((int)N / A) + (N % A != 0) ) * B;
	int moneyY = ( ((int)N / C) + (N % C != 0) ) * D;

	cout << min(moneyX, moneyY) << endl;

	return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
	int N,A,B,C,D,a,b;
	cin>>N>>A>>B>>C>>D;
	a=N/A*B+N%A*B;
	b=N/C*D+N%C*D;
	if(a<b){
		cout<<a<<endl;
	}else{
		cout<<b<<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;

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

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

    if(honsu >= N){
      if(min > kane){
        min = kane;
      }
      break;
    }
  }

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

C++: #include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
int main()
{
    int N,A,B,C,D,x,y;
    cin>>N>>A>>B>>C>>D;
    x=ceil((double)N/A)*B;
    y=ceil((double)N/C)*D;
    
    
    
    
    
    cout<<min(x,y)<<endl;
    return 0;
}

C++: #include <stdio.h>
#include <cmath>
#include <algorithm>
#include <cfloat>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <iostream>
#include <set>
#include <map>
#include <time.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;



int main(){

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

	int X_num,Y_num,X_sum,Y_sum;

	if(N%A == 0){
		X_num = N/A;
	}else{
		X_num = N/A+1;
	}

	X_sum = B*X_num;

	if(N%C == 0){
		Y_num = N/C;
	}else{
		Y_num = N/C+1;
	}

	Y_sum = D*Y_num;

	printf("%d\n",min(X_sum,Y_sum));

	return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<string>
#include<deque>
#define rep(i,rept)	for(int i = 0; i<(ll)rept;++i)
typedef long long ll;
using namespace std;
 
int main() {
	int a, b, c, d, e;
	int needb = 0, needd = 0;
	cin >> a >> b >> c >> d >> e;
	
	if (a%b == 0) {
		needb = a / b;
	}
	else {
		needb = (a / b) + 1;
	}
 
	if (a%d == 0) {
		needd = a / d;
	}
	else {
		needd = a / d + 1;
	}
 
	cout << min(needb * c, needd * e) << endl;
 
}

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+(n%a!=0))*b,(n/c+(n%c!=0))*d)<<endl;
  return 0;
}

C++: #include<iostream>
#include<cmath>
#include<algorithm>
#include <cassert>
#include<string>
#define rep(i,rept) for(long long i = 0; i <(long long)rept;i++)
using namespace std;
int main() {
	int a = 0, b = 0, c = 0, d[100000], e[100000], f = 0, g = 0, h = 0, count = 0,x=0,y=0,z=0;
	char rikka, toka[100000];
	string saya, homu, kyok, mami, mado[50];
	bool gg = true;
	int manji, nk[26] = { false };
	cin >> count >> a >> b >> x >> y;
	if (count%a == 0) {
		c = count / a;
	}
	else { c = count / a + 1; 
	}
	if (count%x == 0) {
		z = count / x;
	}
	else { z = count / x + 1; 
	}
	cout << min(z*y, c*b) << endl;
	return 0;
}

C++: #include <iostream>

void solve() {
    int n, a, b, c, d;
    std::cin >> n >> a >> b >> c >> d;
    std::cout << std::min((n + a - 1) / a * b, (n + c - 1) / c * d)
              << std::endl;
}

int main() {
    std::cin.tie(nullptr);
    std::cout.tie(nullptr);
    std::ios::sync_with_stdio(false);

    solve();

    return 0;
}

C++: #include<sbits/stdc++.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 <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
#include <deque>
#include <iomanip>
#include <limits>
#include <fstream>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
typedef long long ll;
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  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 main(){
    int n,a,b,c,d;
    
    std::cin >> n >> a >> b >> c >> d;
    
    int A = (n+(a-1))/a*b;
    int B = (n+(c-1))/c*d;
    
    if(A<B) std::cout << A << std::endl;
    else std::cout << B << std::endl;
}

C++: #include<bits/stdc++.h>
#define F first
#define S second
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
double eps=1e-8;
ll mod=1e9+7;
ll inf=1e9;
priority_queue<P,vector<P>,greater<P> > pq;

template <typename T>
int Count(const vector<T> &v, T l,T r){
  //counting [l,r]
  auto L = lower_bound(v.begin(), v.end() , l );
  auto R = upper_bound(v.begin(), v.end(), r );
  // [l,r) change upper -> lower

  return R-L;
}

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 <bits/stdc++.h>
#include <math.h>

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

C++: #include <iostream>
using namespace std;
int main(void){
    int N,A,B,C,D,e,f;
    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;
	}

	if (e>f) {
		cout << f << endl;
	}
	else {
		cout << e << endl;
	}
}

C++: #include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <map>
#include <queue>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using namespace std;

template<class T>
constexpr T INF = ::numeric_limits<T>::max() / 32 * 15 + 208;

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) << "\n";
    return 0;
}