Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func nextInt() int {
	sc.Scan()
	n, _ := strconv.Atoi(sc.Text())
	return n
}

func main() {
	sc.Split(bufio.ScanWords)
	N, A, B, C, D := nextInt(), nextInt(), nextInt(), nextInt(), nextInt()

	x := (N + A - 1) / A * B
	y := (N + C - 1) / C * D

	var z int
	if x < y {
		z = x
	} else {
		z = y
	}

	fmt.Println(z)
}

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

int main(){
  int N, A, B, C, D;
  cin >> N >> A >> B >> C >> D;
  int NA, NC;
  NA = (N + A - 1) / A;
  NC = (N + C - 1) / C;
  int ans;
  if(NA*B <= NC*D){
    cout << NA*B << endl;
  }else{
    cout <<  NC*D << endl;
  }
}

C++: #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
// Welcome to my source code!

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

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

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

int main()
{
    int N, A, B, C, D, penX = 0, penY = 0, rateX = 0, rateY = 0;
    cin >> N >> A >> B >> C >> D;

    while (penX < N)
    {
        penX += A;
        rateX += B;
    }

    while (penY < N)
    {
        penY += C;
        rateY += D;
    }
    
    
    if (rateX > rateY)
    {
        cout << rateY <<endl;
    }else{
        cout << rateX <<endl;
    }
    

    return 0;
}

C++: #include <iostream>

int calc(int n, int nset, int fee) {
  return ((n / nset) + (n % nset > 0)) * fee;
}

int main() {
  int n, a, b, c, d;
  std::cin >> n >> a >> b >> c >> d;
  std::cout << std::min(calc(n, a, b), calc(n, c, d)) << std::endl;
}

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 a=n/c+1;
  if(a*b>c*d) cout<<c*d<<endl;
  else cout<<a*b<<endl;
  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<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define LINF (ll)INF*INF
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,a,n) for(int i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

#define int ll //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef vector<pii> vp;

int gcd(int a, int b){
    if(b==0) return a;
    return gcd(b,a%b);
}
int lcm(int a, int b){
    return a/gcd(a,b)*b;
}

int f(int n, int a, int b){
    int t = n/a + (n%a!=0);
    return t*b;
}

signed main(void) {
    int n,a,b,c,d;
    cin >> n >> a >> b >> c >> d;
    cout << min(f(n,a,b),f(n,c,d)) << endl;

}

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;
  int ans = INF;
  for (int x = 0; x <= 1000; x++) {
    for (int y = 0; y <= 1000; y++) {
      int num = a * x + c * y;
      if (num < n) continue;
      cmin(ans, b * x + d * y);
    }
  }
  cout << ans << endl;
}

C++: #include<iostream>
#include<algorithm>
using namespace std;
int main() {
	int n, a, b, c, d; cin >> n >> a >> b >> c >> d;
	int na = n; if (n%a != 0)na += a - (n%a);
	int nc = n; if (n%c != 0)nc += c - (n%c);
	cout << min(na / a*b, na / c*d) << endl;
	return 0;
}

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

using namespace std;

int main(){
	ll n, a, b, c, d, x, y;
	
	cin>>n;
	cin>>a>>b>>c>>d;
	
	x=(n-1)/a;
	y=(n-1)/c;
	x++;
	y++;
	x=x*b;
	y=y*d;
	
	
	cout<<min(x,y)<<"\n";
}

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

using namespace std;

int main()
{
  int N, A, B, C, D;
  int number_of_X, number_of_Y;
  
  cin >> N >> A >> B >> C >> D;

  N % A ? number_of_X = N / A + 1 : number_of_X = N / A;
  N % C ? number_of_Y = N / C + 1 : number_of_Y = N / C;

  number_of_X * B <= number_of_Y * D ?
    cout << number_of_X * B << endl : cout << number_of_Y * D << endl;
}