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++: #define _USE_MATH_DEFINES
#include <iostream> 
#include <string>
#include <map>
#include <math.h>
using namespace std; 
int main(){
	double  N, A, B, C ,D;
	cin >> N >> A >> B >> C >> D;
	double X = ceil(N/A);
	double Y = ceil(N/C);
	if(X*B <= Y*D){
		cout << X*B << endl;
	}
	else{
		cout << Y*D << endl;
	}
	return 0;
}

C++: #include <bits/stdc++.h>
#define int long long
#define endl '\n'
#define FOR(i, a, n) for (int i = (a); i < (n); ++i)
#define REP(i, n) FOR(i, 0, n)
using namespace std;

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    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;
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
#define MOD (1000000007)
#define INF (1e9)
#define INFL (1e18)
 
typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
template<class T>using arr=vector<vector<T>>;
template<class T>void pr(T x){cout << x << endl;}
template<class T>void prvec(vector<T>& a){rep(i, a.size()-1){cout << a[i] << " ";} cout << a[a.size()-1] << endl;}
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
 
int main()
{
    int n, a, b, c, d;
    cin >> n >> a >> b >> c >> d;

    int x = n/a, y = n/c;
    if(n%a!=0) x++;
    if(n%c!=0) y++;
    x *= b;
    y *= d;
    if(x>y) pr(y);
    else pr(x);
    return 0;}

C++: /*宣言*/
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<math.h>
#include<queue>
#include<string.h>
#include<string>
#include<vector>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
int main()
{
	int n, a, b, c, d, ans = 0,x,y;
	cin >> n >> a >> b >> c >> d;
	x = n / a;
	y = n / c;
	if (n%a != 0)
		x++;
	if (n%c != 0)
		y++;
	ans = min(b*x, d*y);
	cout << ans << endl;
	return 0;
}

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

int main(){
  cin.tie(0);
 	ios::sync_with_stdio(false);
  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 << "\n";
  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 ans, tmp;
    tmp = n / a;
    if(n % a > 0) tmp++;
    ans = tmp * b;
    tmp = n / c;
    if(n % c > 0) tmp++;
    ans = min(ans, tmp * d);
    cout << ans << 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 = (n/a)*b + (n%a>0?1:0)*b;
  int y = (n/c)*d + (n%c>0?1:0)*d;
  if ( x > y ) cout << x << endl;
  else cout << y << endl;

  return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=1000000007,MAX=105;
const ll INF=1LL<<55;

int main(){
  int X,A,B,C,D;cin>>X>>A>>B>>C>>D;
  cout<<min((X+A-1)/A*B,(X+C-1)/C*D)<<endl;
}

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

int main() {
int N,A,B,C,D,E,F;
cin >> N >> A >> B >> C >> D;
   E = (N/A)*B;
   F = (N/C)*D;
   if(E>0&&F>0){
   if(A>C && B>D){
       cout<< E <<endl;
  } 
   if(A>C && B<D){
       cout<< E <<endl;
  } 
   if(A>C && B==D){
        cout<< E << endl;
  }
  if(A<C && B>D){
       cout<< F <<endl;
 } 
   if(A<C && B<D){
        cout<< F << endl;
  }
  if(A<C && B==D){
       cout<< F <<endl;
  } 
 
 }
  return 0;

}

C++: #include <iostream>

using namespace std;
int main(){
  int n,a,b,c,d;
  std::cin >>n>>a>>b>>c>>d;
  int min;
  int set_x,set_y;
  if(n%a==0){
    set_x=n/a;
  }else{
    set_x=n/a+1;
  }
  if(n%c==0){
    set_y=n/c;
  }else{
    set_y=n/c+1;
  }

  if(b*set_x<d*set_y){
    min=b*set_x;
  }else{
    min=d*set_y;
  }

  std::cout << min << '\n';

}

C++: #include <bits/stdc++.h>
using namespace std;
int N,A,B,C,D;
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 nedan(int a,int i,int price){
    int E;
    if (a%i!=0){
        E=((int)((a/i)+1))*price;
    }else{
        E=(int)(a/i)*price;
    }
    return E;
}
int main(){
    int N,A,B,C,D;
    cin >> N >> A >> B >> C >> D;
    if(nedan(N,A,B)<nedan(N,C,D)){
        cout<<nedan(N,A,B)<<endl;
    }else{
        cout<<nedan(N,C,D)<<endl;
    }
}

C++: #include <iostream>
using namespace std;
int main(void){
    int N,A,B,C,D;
    cin >> N >> A >> B >> C >> D;
    int x,y,X,Y;
    
    if(N%A == 0 && N%C == 0){
        x = N/A;
        y = N/C;
        
        X = x*B;
        Y = y*D;
        
        if(X > Y){
            cout << Y << endl;
        }
        else{
            cout << X << endl;
        }
    }
    else if(N%A == 0 && N%C != 0){
        x = N/A;
        y = N/C + 1;
        
        X = x*B;
        Y = y*D;
        
        if(X > Y){
            cout << Y << endl;
        }
        else{
            cout << X << endl;
        }
    }
    else if(N%A != 0 && N%C == 0){
        x = N/A + 1;
        y = N/C;
        
        X = x*B;
        Y = y*D;
        
        if(X > Y){
            cout << Y << endl;
        }
        else{
            cout << X << endl;
        }
    }
    else if(N%A != 0 && N%C != 0){
        x = N/A + 1;
        y = N/C + 1;
        
        X = x*B;
        Y = y*D;
        
        if(X > Y){
            cout << Y << endl;
        }
        else{
            cout << X << endl;
        }
    }
}

C++: #include<iostream>
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 <algorithm>
using namespace std;

int a, b, c, d, n;

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

C++: #include <iostream>
#include<algorithm>
#include<math.h>
using namespace std;
int main()
{
    double n,a,b,c,d;
    cin>>n>>a>>b>>c>>d;
    
 
    
    if(ceil(n/a)*b<ceil(n/c)*d){
        cout<<ceil(n/a)*b<<endl;
    }
    
    else
        cout<<ceil(n/c)*d<<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=0;
    int y=0;

    x=(N+(A-1))/A;
    y=(N+(C-1))/C;

    int a=0;
    int b=0;

    a=x*B;
    b=y*D;

    if(a<b){
        cout<<a<<endl;
    }else{
        cout<<b<<endl;
    }

return 0;

}

C++: #include<stdio.h>
int main(void)
{
	int x[2],n,a[2][2],i,k;
	scanf("%d",&n);
	for(i=0;i<2;i++)	scanf("%d %d",&a[i][0],&a[i][1]);
//for(i=0;i<2;i++) printf("%d %d\n",a[i][0],a[i][1]);
	for(i=0;i<2;i++){
		for(k=1;k<=n;k++){
			if(k*a[i][0]>=n){
				x[i]=k*a[i][1];
				break;
			}
		}
	}
//printf("aaa\n");
	if(x[0]<x[1]) printf("%d\n",x[0]);
	else printf("%d\n",x[1]);
	return 0;
}

C++: #include<iostream>
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;
}