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 REP(i, n) for (int i = 0; i < (n); i++)
#define FOR(i, init, n) for(int i = init; i < (n); i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define fi first
#define se second

using namespace std;
using ll = long long int;
using P = pair<int, int>;
using T = tuple<int, int, int>;
using edge = struct
{
    int to, cost;
};

const int MOD = 1e9 + 7;
const int iINF = 1e9;
const long long int llINF = 1e18;
const double PI = acos(-1.0);

const int dx[4] = {1, 0, -1, 0};
const 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;

    int now = 0, ans1 = 0, ans2 = 0;

    while(now < N)
    {
        ans1 += B;
        now += A;
    }

    now = 0;

    while(now < N)
    {
        ans2 += D;
        now += C;
    }

    cout << min(ans1, ans2) << endl;

    return 0;
}

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<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 <cstdio>
#include <algorithm>

using namespace std;

const int INF = 1000000000;

int main(){
  int n, a, b, c, d;

  scanf("%d%d%d%d%d", &n, &a, &b, &c, &d);

  int ans = min((n+a-1)/a * b, (n+c-1)/c * d);

  printf("%d\n",ans);

  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 X = (N + A - 1) / A * B;
  int Y = (N + C - 1) / C * D;

  cout << min(X, Y) << 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 ans = min(ceil((double)n/a)*b,ceil((double)n/c)*d);
	cout <<ans<<endl;
	return 0;
}

C++: #include <iostream>

int min(int a, int b){
    if(a>b) return b;
    else return a;
}

int price(int n, int a, int b){
    int num = a;
    int price = b;
    while(n > num) {
        num += a;
        price += b;
    }
    return price;
}
int main()
{
    int n, a, b, c, d;
    int sum[2];
    std::cin >> n >> a >> b >> c >> d;
    sum[0] = price(n,a,b);
    sum[1] = price(n,c,d);
    std::cout << min(sum[0],sum[1]) << std::endl;
    return 0;
}

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;
  
int main(){

  int n,a,b,c,d,numa,numb,suma,sumb;
  cin>>n>>a>>b>>c>>d;
  numa=n/a; numb=n/c; suma=numa*b; sumb=numb*d;
  if(n%a!=0) suma+=b;
  if(n%c!=0) sumb+=d;
  if(suma<sumb) cout<<suma<<endl;
  else cout<<sumb<<endl;
  return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
int main (void)
{
    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>
#include<math.h>
#include<cstdio>
#include<ctype.h>
#include<stdio.h>
#include<set>
#include<vector>
#include<map>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<numeric>
#include<string>
using namespace std;
typedef long long ll;
ll MOD = 1000000007;
int main() {
	ll N, A, B, C, D;
  	cin>>N>>A>>B>>C>>D;
	cin >> N >> A >> B >> C >> D;
       ll x = N/A;
       if(N%A!=0)x++;
       ll y =N/C;
       if(N%C!=0)y++;
       cout<<min(x*B,y*D)<<endl;
}

C++: #include<bits/stdc++.h>
using namespace std;
int main(){
  int n,a,b,c,d;
  cin>>n>>a>>b>>c>>d;
  int ans=0;
  for(int i=0;1;i++){
    for(int j=0;1;j++){
      if(j*c+i*a>=n){
	if(ans==0) ans=i*b+j*d;
	else if(ans>i*a*b+j*c*d) ans=i*b+j*d;
	break;
      }
    }
    if(i*a<=n) break;
  }
  cout<<ans<<endl;
  return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
int main(){
	int n,a,b,c,d,cnt=0,cnt2=0,pen1=0,pen2=0,cost=0;
	cin>>n>>a>>b>>c>>d;
	while(n>=pen1){
		pen1=pen1+a;
		cnt++;}
	while(n>pen2){
		pen2=pen2+c;
		cnt2++;}
	if(pen1>pen2)
		cost=cnt2*d;
	if(pen2>pen1)
		cost=cnt*b;
	if(pen1==pen2)
		cost=cnt2*d;
	cout<<cost<<endl;
	
	return 0;
}

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

int a, b, c, d, n;

signed main()
{
    cin >> n >> a >> b >> c >> d;
    printf("%lld\n", min(((n + a - 1) / a) * b, ((n + c - 1) / c) * 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;
  cout<<min( (n+a-1)/a*b , (n+c-1)/c*d )<<endl;
  return 0;
}

C++: #include "bits/stdc++.h"
#define rep(i,a,n) for(int i = (a);i < (n);i++)
typedef unsigned long long ull;
typedef long long ll;
using namespace std;

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

C++: #include <stdio.h>

int main(){
	int N,A,B,C,D;
	scanf("%d%d%d%d%d",&N,&A,&B,&C,&D);
	int ma = (N / A + (N%A != 0 ? 1 : 0)) * B;
	int mb = (N / C + (N%C != 0 ? 1 : 0)) * D;
	printf("%d\n",ma > mb ? mb : ma);
	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 << y << endl;
  else cout << x << endl;

  return 0;
}

C++: #include <iostream>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <algorithm>
#include <cmath>
#define rep(i,j,k) for(int i=(int)j;i<(int)k;i++)
using namespace std;

int main(void){
    int n;
    double a,b,c,d;
    cin>>n>>a>>b>>c>>d;
    
    int x1=ceil(n/a),x2=ceil(n/c);
    if(x1*b<x2*d)cout<<x1*b<<endl;
    else cout<<x2*d<<endl;
    
    
    
    
    
    return 0;
}