Go: package main

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

var scanner = bufio.NewScanner(os.Stdin)

func nextString() string {
	scanner.Scan()
	return scanner.Text()
}

func nextInt() (int, error) {
	return strconv.Atoi(nextString())
}

func nextFloat64() (float64, error) {
	return strconv.ParseFloat(nextString(), 64)
}

func stringifyArray(arr []int) string {
	return strings.TrimRight(fmt.Sprintf("%+v", arr)[1:], "]")
}

func min(x, y int) int {
	if x < y {
		return x
	}
	return y
}
func main() {
	scanner.Split(bufio.ScanWords)

	n, _ := nextInt()
	a, _ := nextInt()
	b, _ := nextInt()
	c, _ := nextInt()
	d, _ := nextInt()

	costX := b * int(math.Ceil(float64(n)/float64(a)))
	costY := d * int(math.Ceil(float64(n)/float64(c)))
	fmt.Println(min(costX, costY))
}

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

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