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>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <tuple>
# include <unordered_map>
# include <numeric>
# include <complex>
# include <bitset>
# include <random>
# include <chrono>
# include <cstdlib>
# include <tuple>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
constexpr int INF = 2147483647;
constexpr int HINF = INF / 2;
constexpr double DINF = 100000000000000000.0;
constexpr double HDINF = 50000000000000000.0;
constexpr long long LINF = 9223372036854775807;
constexpr long long HLINF = 4500000000000000000;
const double PI = acos(-1);
template <typename T_char>T_char TL(T_char cX) { return tolower(cX); };
template <typename T_char>T_char TU(T_char cX) { return toupper(cX); };
# define ALL(x)      (x).begin(),(x).end()
# define UNIQ(c)     (c).erase(unique(ALL((c))),(c).end())
# define LOWER(s)    transform(ALL((s)),(s).begin(),TL<char>)
# define UPPER(s)    transform(ALL((s)),(s).begin(),TU<char>)
# define FOR(i,a,b)  for(LL i=(a);i<(b);i++)
# define RFOR(i,a,b) for(LL i=(a);i>=(b);i--)
# define REP(i,n)    FOR(i,0,n)
# define INIT        std::ios::sync_with_stdio(false);std::cin.tie(0)

int n, a, b, c, d;

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

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

using namespace std;

int main(void)
{
int n,a,b,c,d,k,m,x,y;
cin >> n >> a >> b >> c >> d;
k=n/a;
m=n/c;
if(n>k*a){
k++;}
x=k*b;
if(n>m*c){
m++;}
y=m*d;
if(x>=y){
cout << y << endl;}
else if(x<=y){
cout << x << endl;}
return 0;
}

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

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

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

int main() {
	int N, A, B, C, D;
	cin >> N >> A >> B >> C >> D;
	int X1 = (N + A - 1) / A;
	int X2 = (N + C - 1) / C;
	cout << min(X1 * B, X2 * D) << endl;
	return 0;
}

C++: #include <iostream>

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

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

  int qty_x = n % a == 0 ? n / a : (n / a) + 1;
  int qty_y = n % c == 0 ? n / c : (n / c) + 1;

  int cost_x = qty_x * b;
  int cost_y = qty_y * d;

  if (cost_x <= cost_y) {
    std::cout << cost_x << std::endl;
  } else {
    std::cout << cost_y << std::endl;
  }

  return 0;
}

C++: #include <cstdio>
#include <algorithm>
#include <vector>

using namespace std;


int main(){
    int n,a,b,c,d;
    scanf("%d %d %d %d %d",&n,&a,&b,&c,&d);
    
    int ans = n / a * b;
    if(n % a != 0){
        ans += b;
    }
    
    if(n % c == 0){
        ans = min(ans,n / c * d);
    }else{
        ans = min(ans,n / c * d + d);
    }

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

    return 0;
    
}

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

C++: #include <iostream>
#include <algorithm>
using namespace std;
int main(void){
 int a,b,c,d,n,x,y,z;
 cin>>n>>a>>b>>c>>d;
 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;
}
 z=min(x*b,y*d);
 cout<<z<<endl;
  }

C++: #include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <sstream>
#include <cstdlib>
using namespace std;
int main(){
	int i,o,s,t,r,e=1,a=1,m,q;
	cin>>i>>o>>s>>t>>r;
	m=o;
	q=t;
	while(i>m){
		e++;
		m=m+o;
	}
	while(i>q){
		a++;
		q=q+t;
	}
	s=s*e;
	r=r*a;
	if(s<=r){
		cout<<s;
	}else{
		cout<<r<<endl;
	}
return 0;
}

C++: #include <bits/stdc++.h>
typedef long long i64;
using std::cout;
using std::endl;
using std::cin;

int main(){
	int n, a, b, c, d; cin >> n >> a >> b >> c >> d;
	
	cout << std::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,a,b;
	cin>>N>>A>>B>>C>>D;
	a=N/A*B;
	b=N/C*D;
	if(N%A!=0)a=a+B;
	if(N%C!=0)b=b+D;
	if(a<b){
		cout<<a<<endl;
	}else{
		cout<<b<<endl;
	}
	return 0;
}

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

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

C++: #include <stdio.h>

int CalcTotalVal(int iTargetNumber, int iSetNumber, int iSetValue);

int main(int argc, char *argv[])
{
    // 条件を入力してもらう
    int iTargetNumber = 0, iSetANumber = 0, iSetAValue = 0, iSetBNumber = 0, iSetBValue = 0;
    scanf("%d %d %d %d %d",&iTargetNumber,&iSetANumber,&iSetAValue,&iSetBNumber,&iSetBValue);
    
    // ASet、BSetの必要金額を計算
    int iSetATotalVal = 0, iSetBTotalVal = 0;
    iSetATotalVal = CalcTotalVal(iTargetNumber, iSetANumber, iSetAValue);
    iSetBTotalVal = CalcTotalVal(iTargetNumber, iSetBNumber, iSetBValue);
    
    // 安い方を出力
    int iAnsVal = 0;
    if(iSetATotalVal < iSetBTotalVal){
        iAnsVal = iSetATotalVal;
    }
    else{
        iAnsVal = iSetBTotalVal;
    }
    printf("%d\n", iAnsVal);

    return 0;
}

int CalcTotalVal(int iTargetNumber, int iSetNumber, int iSetValue)
{
    int iSetCount = 0;
    if(iSetNumber != 0){
        iSetCount = iTargetNumber / iSetNumber;
        if(iTargetNumber % iSetNumber != 0){
            iSetCount += 1;
        }
    }
    return iSetValue * iSetCount;
}

C++: #include<iostream>
#include <algorithm>
using namespace std;
int main()
{
    int N, A, B, C, D, X, Y, i = 0, j = 0, a = 0, b = 0;
    cin >> N >> A >> B >> C >> D;
    X = B;
    Y = D;
    while (N > a)
    {
        a += A;
        i++;
    }
    while (N > b)
    {
        b += C;
        j++;
    }
    X *= i;
    Y *= j;
    if (X < Y)
        cout << X << endl;
    else
        cout << Y << 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, totalX, totalY;

	cin >> n >> a >> b >> c >> d;
	totalX = (n / a + (n%a == 0 ? 0 : 1)) * b;
	totalY = (n / c + (n%c == 0 ? 0 : 1)) * d;
	cout << min(totalX, totalY) << endl;

	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
int N,A,B,C,D;
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;
}