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 <bits/stdc++.h>
using ll = long long;
using namespace std;
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for(int i = int(a); i < int(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
const long long INFLL = 1LL << 60;
const int INFINT = 1 << 30;
const long long MOD = 1e9 + 7;

template <class T> void vecout(T V) {
    auto t = V.begin();
    while(t != V.end()) {
        cout << *t++;
        if(t != V.end()) cout << " ";
    }
    cout << endl;
};

int main() {
    int N, A, B, C, D;
    cin >> N >> A >> B >> C >> D;
    cout << min(B * ceil(N * 1.0 / A), D * ceil(N * 1.0 / C)) << endl;
}

C++: #include <iostream>
#include <cstdlib>

using namespace std;

int cost(int n, int x, int y)
{
  int m = int(n/x);
  if(n%x!=0) {
    m += 1;
  }
  return m*y;
}

int main()
{
  int n, a, b, c, d;
  cin >> n >> a >> b >> c >> d;
  
  cout << min(cost(n, a, b), cost(n, c, d)) << endl;
  return 0;
}

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

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

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

//I am a failure. I am a failure. I am a failure. I am a failure. I am a failure. I am a failure. I am a failure. I am a failure. I am a failure. I am a failure. I am a failure. I am a failure. I am a failure. I am a failure. I am a failure. I am a failure. I am a failure. I am a failure. 
	
//I am a failure. I am a failure. I am a failure. I am a failure. I am a failure. I am a failure. I am a failure. I am a failure. I am a failure. I am a failure. I am a failure. I am a failure. I am a failure. I am a failure. I am a failure. I am a failure. I am a failure. I am a failure.

//I am a failure. I am a failure. I am a failure. I am a failure. I am a failure. I am a failure. I am a failure. I am a failure. I am a failure. I am a failure. I am a failure. I am a failure. I am a failure. I am a failure. I am a failure. I am a failure. I am a failure. I am a failure.






//I am a failure. I am a failure. I am a failure. I am a failure. I am a failure. I am a failure. I am a failure. I am a failure. I am a failure. I am a failure. I am a failure. I am a failure. I am a failure. I am a failure. I am a failure. I am a failure. I am a failure. I am a failure.
//I am a failure. I am a failure. I am a failure. I am a failure. I am a failure. I am a failure. I am a failure. I am a failure. I am a failure. I am a failure. I am a failure. I am a failure. I am a failure. I am a failure. I am a failure. I am a failure. I am a failure. I am a failure.
//I am a failure. I am a failure. I am a failure. I am a failure. I am a failure. I am a failure. I am a failure. I am a failure. I am a failure. I am a failure. I am a failure. I am a failure. I am a failure. I am a failure. I am a failure. I am a failure. I am a failure. I am a failure.
//I am a failure. I am a failure. I am a failure. I am a failure. I am a failure. I am a failure. I am a failure. I am a failure. I am a failure. I am a failure. I am a failure. I am a failure. I am a failure. I am a failure. I am a failure. I am a failure. I am a failure. I am a failure.
//I am a failure. I am a failure. I am a failure. I am a failure. I am a failure. I am a failure. I am a failure. I am a failure. I am a failure. I am a failure. I am a failure. I am a failure. I am a failure. I am a failure. I am a failure. I am a failure. I am a failure. I am a failure.

C++: #include <iostream>

using namespace std;

int main() {

	int n, a, b, c, d;
	int i, j, l;
	int sumA = 0, cnt = 1, sumB = 0;

	cin >> n >> a >> b >> c >> d;

	for (i = a; i <= n; i = i + a-1) {
		sumA = b * cnt;
		cnt++;
	}

	cnt = 1;

	for (i = c; i <= n; i = i + c-1) {
		sumB = d * cnt;
		cnt++;
	}

	if (sumA >= sumB) cout << sumB << endl;
	else cout << sumA << endl;
	
//	cout << sumA <<endl << sumB;

//	cin >> a;

	return 0;
}

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

//x：A本でB円
//y：C本でD円
//xかyを選択
//n本以上を購入

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

	int a_no = ceil((float)n / (float)a);
	int a_price = a_no * b;

	int c_no = ceil((float)n / (float)c);
	int c_price = c_no * d;

	printf("%d\n", a_price < c_price ? a_price : c_price);
}

C++: #include <iostream>
#include <algorithm>

using namespace std;

int FindLeast( int needs, int pieces, int val ) {
    int k = 1;
    while ( k*pieces < needs ) ++k;
    return k*val;
}
main() {
    int n, a, b, c, d;
    cin >> n >> a >> b >> c >> d;
    cout << min( FindLeast( n, a, b ), FindLeast( n, c, d ) ) << endl;
}

C++: #include <iostream>
#include <algorithm>
using namespace std;
int main() {
	int N, A, B, C, D;
	cin >> N >> A >> B >> C >> D;
	int setsX = (N + A - 1) / A;
	int setsY = (N + C - 1) / C;
	cout << min(B * setsX, D * setsY) << 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;
    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 sum = 0;
    int sum1 = 0;
    for (int i=0;i<N;i=i+A){
       sum = sum+B;
    }
    for (int i=0;i<N;i=i+B){
       sum1 = sum1+D;
    }
    if(sum<=sum1){
      cout<<sum+B<<endl;
    } else {
      cout<<sum+D<<endl;
    }
    return 0;
}

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