Go: package main

import (
	"fmt"
	"os"
	"strconv"
	"bufio"
	"strings"
)
func main2(){
ans(10,3,50,4,60)
ans(10 ,3, 100, 5, 180)//360
ans(6, 2, 200, 3, 300)// 600

}

func main() {



    sc := bufio.NewScanner(os.Stdin)
     sc.Scan()
        args := strings.Split(sc.Text(), " ")
      

	var n, a, b, c, d int

	n, _ = strconv.Atoi(args[0])
	a, _ = strconv.Atoi(args[1])
	b, _ = strconv.Atoi(args[2])
	c, _ = strconv.Atoi(args[3])
	d, _ = strconv.Atoi(args[4])

        ans(n,a,b,c,d)
}

func ans(n,a,b,c,d int){

	ans2 := 0
	for i := 0; i < 1000; i++ {
		if i*a >= n {
			ans2 = i * b
			break
		}
	}

	for i := 0; i < 1000; i++ {
	
		if i*c >= n {
			if ans2 > i*d {


				ans2 = i *  d
			}
			break
		}
	}

	fmt.Printf("%d\n", ans2)
}

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

C++: #include<bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
int main(){
    int n,a,b,c,d;
    cin>>n>>a>>b>>c>>d;
    int sum1=0,sum2=0,n1=n,n2=n;
    while(n1>0){
        n1-=a;
        sum1+=b;
    }
    while(n2>0){
        n2-=c;
        sum2+=d;
    }
    cout<<min(sum1,sum2)<<endl;
}

C++: #include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repr(i, n) for(int i = n; i >= 0; i++)
#define REP(i, m, n) for(int i = m; i < n; i++)
#define SORT(v) sort((v).begin(), (v).end())
#define REV(v) sort((v).begin(), (v).end(), greater<int>())
typedef long long ll;
int gcd(int a,int b){return b?gcd(b,a%b):a;};
int lcm(int a,int b){return a * b / gcd(a, b);};

int main() {
  int n, a, b, c, d;
  cin >> n >> a >> b >> c >> d;
  cout << min(((n - 1) / a + 1) * b, ((n - 1) / c + 1) * 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 = INF;
  
  for(int i=0;;i++){
    ans = min(ans, i*b + max(0, (n-(i*a) + c-1)/c) * d);
    if(i*a >= n) break;
  }

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

  return 0;
}

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

using namespace std;

#define inf 1<<30
#define llong long long
#define usd unsigned
#define pqueue priority_queue
#define mp make_pair
#define pb push_back
#define fn fill_n
typedef pair<int, int> P;
typedef struct data{
	int now;
	int cost;

	bool operator<(const data &ri) const{
		return cost < ri.cost;
	}
	bool operator>(const data &ri) const{
		return cost > ri.cost;
	}
}data;
int nw[9] = {0, 1, 0, -1, -1, 1, 1, -1, 0};
int nh[9] = {1, 0, -1, 0, 1, 1, -1, -1, 0};



int main(){
	int n, a, b, c, d;
	cin >> n >> a >> b >> c >> d;
	cout << min(b*(n/a+(n%a?1:0)), d*(n/c+(n%c?1:0))) << endl;

	return 0;
}

C++: #included<bits/stdc++.h>
int main(){
    int N,A,B,C,D;
    double x,y;
    scanf("%d%d%d%d%d",&N,&A,&B,&C,&D);
    x=N/A;
    y=N/C;
    x=ceil(x);
    y=ceil(y);
    if (B*x <= D*y)
{printf(B*x);
else{printf(D*y);}



return 0;
}

C++: #include<iostream>
#include<string>
#include<algorithm>	
#include<cmath>
using namespace std;
int main() {
	int n, a, b, c, d, sum = 0, num = 0;
	cin >> n >> a >> b >> c >> d;
	if (n % a == 0) {
		sum = n / a * b;
	}
	else {
		sum = (n / a + 1) * b;
	}
	if (n % c == 0) {
		num = n / c * d;
	}
	else {
		num = (n / c + 1) * d;
	}
	cout << min(sum, num) << endl;
	cin >> n;
}

C++: 
#include <iostream>
using namespace std;
int main(void){
    int a,b,c,d,x,y,e,f,n;
    cin>>n>>a>>b>>c>>d;
    x=0;
    y=0;
    if(n%a==0){
        x=n/a;
    }
    else if(n%a>0){
        x=n/a+1;
    }
    if(n%c==0){
        y=n/c;
    }
    else if(n%c>0){
        y=n/c+1;
    }
    e=x*b;
    f=y*d;
    if(e<f){
        cout<<e<<endl;
    }
    else if(e==f){
        cout<<e<<endl;
    }
    else{
        cout<<f<<endl;
    }
}

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

int n, a, b, c, d;

int main(){
  
  cin>>n>>a>>b>>c>>d;
  
  int v1 = n/a*b;
  if(n%a) v1+=b;
  
  int v2 = n/c*d;
  if(n%c) v1+=d;

  cout<<min(v1, v2)<<endl;
  
  return 0;
}

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