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>  // g++ -std=c++14 -o a a.cpp

using namespace std;

typedef pair<int, int> P;
typedef long long ll;

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repto(i, n) for(int i = 0; i <= (n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007
#define DEBUG(x) cout << #x << ": " << x << endl;

__attribute__((constructor))
void initial() {
    cin.tie(0);
    ios::sync_with_stdio(false);
}

int main() {
    int N, A, B, C, D;
    cin >> N >> A >> B >> C >> D;
    int resultX, resultY;

    resultX = (N / A) * B;
    if (N % A != 0) {
        resultX += B;
    }

    resultY = (N / C) * D;
    if (N % C != 0) {
        resultY += D;
    }

    cout << min(resultX, resultY) << endl;
}

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

int main() {
  int N, A, B, C, D, n = 0, m = 0;
  cin >> N >> A >> B >> C >> D;
  while((n * A) < N) n++;
  while((m * C) < N) m++;
  cout << min((n * B), (m * D)) << endl;
  return 0;
}

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

using namespace std;

template <typename T>
T cin2var()
{
    T val;
    cin >> val;
    return val;
}

void sub()
{
    const auto N(cin2var<size_t>());
    const auto A(cin2var<size_t>());
    const auto B(cin2var<size_t>());
    const auto C(cin2var<size_t>());
    const auto D(cin2var<size_t>());

    const auto div_x = ceil(N / static_cast<double>(A));
    const auto sum_x = div_x * B;
    const auto div_y = ceil(N / static_cast<double>(C));
    const auto sum_y = div_y * D;
    const auto ans   = min(sum_x, sum_y);

    cout << ans << endl;
}

int main()
{
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    sub();
    return 0;
}

C++: #include <iostream>
using namespace std;
int main(void){
    int n,a,b,c,d;
    int x,y;
    cin >> n,a,b,c,d;
    
    x=n/a;
    if(x!=1) x++;
    x=x*c;

    y=n/b;
    if(y!=1) y++;
    y=y*d;

    if(x<y){
     cout << y;
    }else{
     cout << x;
    }

return 0;
    
}

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

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

  int x = ceil(n / a);
  int y = ceil(n / c);
  int ans = min(x * b, y * d);

  cout << ans << endl;
}

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

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

  int moneyA = 0, moneyC = 0;

  for (int i = 0; i < N; i += A) {
    moneyA += B;
  }

  for (int i = 0; i < N; i += C) {
    moneyC += D;
  }

  moneyA <= moneyC ? cout << moneyA << endl : cout << moneyC << endl;
}

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

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\n");}
else{printf("D*y\n");}
return 0;
}

C++: #include<vector>
#include<iostream>
#include<algorithm>
using namespace std;
int kai(int n) {
	if (n == 0) {
		return 1;
	}
	else {
		return n * kai(n - 1);
	}
}
int rui(int n) {
	if (n == 0) {
		return 1;
	}
	else {
		return 2 * rui(n - 1);
	}
}
int ord(int n) {
	if (n % 2 == 1) {
		return 0;
	}
	else {
		return 1 + ord(n / 2);
	}
}
int main() {
	int n; int ans = 0;
	cin >> n;
	if (n == 1) {
		cout << 0 << endl << 1;
	}
	else if (n == 3) {
		cout << "0 1 -1" << endl << "-1 0 1" <<endl<< "1 -1 0" << endl << 1;
	}
	else {
		vector<long long> ko(n);
		vector<vector<int>> hyo(n, vector<int>(n, 0));
		long long ba = 4 * n;
		vector<long long> rba(n);
		rba[0] = 1;
		for (int i = 1; i < n; i++) {
			rba[i] = rba[i - 1] * ba;
		}
		for (int i = 1; i < n; i++) {
			if (2 * i < n) {
				hyo[0][i] = 1;
				hyo[i][0] = -1;
			}
			else {
				hyo[0][i] = -1;
				hyo[i][0] = 1;
			}
			for (int j = i + 1; j < n; j++) {
				hyo[i][j] = 1;
				hyo[j][i] = -1;
			}
			ko[i] = n + 1 - 2 * i;
			if (ko[i] > 0) {
				ko[i] -= 2;
			}
		}
		long long koin = 0;//koin <=ba no n jou//36no9jou
		for (int i = 0; i < n; i++) {
			koin += ko[i] * rba[i];
		}
		int bi = ((n - 1)*(n - 2)) / 2;
		vector<int> jit(bi);
		vector<int> jim(bi);
		int xx = 0;
		for (int i = 1; i < n; i++) {
			for (int j = i + 1; j < n; j++) {
				jit[xx] = i;
				jim[xx] = j;
				xx++;
			}
		}
		int cha;
		int chx;
		int chy;
		int jou = rui(bi);
		vector<long long> jan(rui(20));
		vector<int> zer(n, 0);
		vector<int> mju0((n - 1) / 2);
		vector<int> mju1((n - 1) / 2);
		for (int i = 1; 2 * i < n; i++) {
			mju0[i - 1] = i; mju1[i - 1] = i + ((n - 1) / 2);
		}
		vector<int> ju0 = mju0; vector<int> ju1 = mju1;
		for (int i = 1; i < jou; i++) {
			cha = ord(i);
			chx = jit[cha];
			chy = jim[cha];
			long long x = hyo[chx][chy];
			long long t = 2;
			koin -= x * t* rba[chx];
			koin += x * t * rba[chy];
			hyo[chx][chy] = -x;
			hyo[chy][chx] = x;
			if (koin == 0) {
				vector<vector<int> > qhyo;
				int uni = 1;
				long long kaz = 0;
				ju0 = mju0; ju1 = mju1;
				for (int ty = 0; ty < n and uni ==1; ty++) {
					if (ty == 1) {
						qhyo = hyo;
					}
					if (ty >= 1) {
						vector<int> ti1((n - 1) / 2);
						vector<int> ti2((n - 1) / 2);
						int xy = 0;
						int xz = 0;
						for (int i = 0; i < n; i++) {
							if (qhyo[ty][i] == 1) {
								ti1[xy] = i;
								xy++;
							}
							else if (ty != i) {
								ti2[xz] = i;
								xz++;
							}
						}
						vector<int> ti(n, ty);
						for (int i = 1; i < n; i++) {
							if (2 * i < n) {
								ti[i] = ti1[i-1];
							}
							else {
								ti[i] = ti2[i - ((n + 1) / 2)];
							}
						}
						for (int j = 0; j < n; j++) {
							for (int k = 0; k < n; k++) {
								hyo[j][k] = qhyo[ti[j]][ti[k]];
							}
						}
					}
					for (int j = 0; j < kai((n - 1) / 2) and uni == 1; j++) {
						for (int k = 0; k < kai((n - 1) / 2) and uni == 1; k++) {
							vector<int> jun(n, 0);
							for (int i = 1; i < n; i++) {
								if (2 * i < n) {
									jun[i] = ju0[i - 1];
								}
								else {
									jun[i] = ju1[i - (n + 1) / 2];
								}
							}
							long long qkaz = 0;
							for (int x = 1; x < n; x++) {
								for (int y = x+1; y < n; y++) {
									qkaz = qkaz * 2 + (((hyo[jun[x]][jun[y]])+1)/2);
								}
							}
							if (j == 0 and k == 0) {
								kaz = qkaz;
							}
							for (int l = 0; l < ans; l++) {
								if (qkaz == jan[l]) {
									uni = 0;
								}
							}
							next_permutation(ju1.begin(), ju1.end());
						}
						next_permutation(ju0.begin(), ju0.end());
					}
				}
				ju0 = mju0; ju1 = mju1;
				if (uni == 1) {
					jan[ans] = kaz;
					ans++;
					for (int j = 0; j < n; j++) {
						for (int k = 0; k < n; k++) {
							cout << hyo[j][k] << " ";
						}
						cout << endl;
					}
					cout << endl;
				}
			}
		}
		cout << ans << endl;
	}
	cin >> n;
}