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<cstdio>
#include<iostream>
#include<algorithm>
#include<math.h>
#include<queue>
#include<string.h>
#include<string>
#include<vector>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
int main()
{
	int n, a, b, c, d, ans = 0,x,y;
	cin >> n >> a >> b >> c >> d;
	x = n / a;
	y = n / c;
	if (n%a != 0)
		x++;
	if (n%c != 0)
		y++;
	ans = min(b*x, d*y);
	cout << ans << endl;
	return 0;
}

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

int main(){
  cin.tie(0);
 	ios::sync_with_stdio(false);
  int N, A, B, C, D;
  cin >> N >> A >> B >> C >> D;
  int ans = min((N + A - 1) / A * B, (N + C - 1) / C * D);
  cout << ans << "\n";
  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 ans, tmp;
    tmp = n / a;
    if(n % a > 0) tmp++;
    ans = tmp * b;
    tmp = n / c;
    if(n % c > 0) tmp++;
    ans = min(ans, tmp * d);
    cout << ans << endl;
    return 0;
}

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

int main(){
  int n, a, b, c, d;
  cin >> n >> a >> b >> c >> d;
  int x = (n/a)*b + (n%a>0?1:0)*b;
  int y = (n/c)*d + (n%c>0?1:0)*d;
  if ( x > y ) cout << x << endl;
  else cout << y << endl;

  return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=1000000007,MAX=105;
const ll INF=1LL<<55;

int main(){
  int X,A,B,C,D;cin>>X>>A>>B>>C>>D;
  cout<<min((X+A-1)/A*B,(X+C-1)/C*D)<<endl;
}

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

int main() {
int N,A,B,C,D,E,F;
cin >> N >> A >> B >> C >> D;
   E = (N/A)*B;
   F = (N/C)*D;
   if(E>0&&F>0){
   if(A>C && B>D){
       cout<< E <<endl;
  } 
   if(A>C && B<D){
       cout<< E <<endl;
  } 
   if(A>C && B==D){
        cout<< E << endl;
  }
  if(A<C && B>D){
       cout<< F <<endl;
 } 
   if(A<C && B<D){
        cout<< F << endl;
  }
  if(A<C && B==D){
       cout<< F <<endl;
  } 
 
 }
  return 0;

}

C++: #include <iostream>

using namespace std;
int main(){
  int n,a,b,c,d;
  std::cin >>n>>a>>b>>c>>d;
  int min;
  int set_x,set_y;
  if(n%a==0){
    set_x=n/a;
  }else{
    set_x=n/a+1;
  }
  if(n%c==0){
    set_y=n/c;
  }else{
    set_y=n/c+1;
  }

  if(b*set_x<d*set_y){
    min=b*set_x;
  }else{
    min=d*set_y;
  }

  std::cout << min << '\n';

}

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

C++: #include <iostream>
using namespace std;
int nedan(int a,int i,int price){
    int E;
    if (a%i!=0){
        E=((int)((a/i)+1))*price;
    }else{
        E=(int)(a/i)*price;
    }
    return E;
}
int main(){
    int N,A,B,C,D;
    cin >> N >> A >> B >> C >> D;
    if(nedan(N,A,B)<nedan(N,C,D)){
        cout<<nedan(N,A,B)<<endl;
    }else{
        cout<<nedan(N,C,D)<<endl;
    }
}

C++: #include <iostream>
using namespace std;
int main(void){
    int N,A,B,C,D;
    cin >> N >> A >> B >> C >> D;
    int x,y,X,Y;
    
    if(N%A == 0 && N%C == 0){
        x = N/A;
        y = N/C;
        
        X = x*B;
        Y = y*D;
        
        if(X > Y){
            cout << Y << endl;
        }
        else{
            cout << X << endl;
        }
    }
    else if(N%A == 0 && N%C != 0){
        x = N/A;
        y = N/C + 1;
        
        X = x*B;
        Y = y*D;
        
        if(X > Y){
            cout << Y << endl;
        }
        else{
            cout << X << endl;
        }
    }
    else if(N%A != 0 && N%C == 0){
        x = N/A + 1;
        y = N/C;
        
        X = x*B;
        Y = y*D;
        
        if(X > Y){
            cout << Y << endl;
        }
        else{
            cout << X << endl;
        }
    }
    else if(N%A != 0 && N%C != 0){
        x = N/A + 1;
        y = N/C + 1;
        
        X = x*B;
        Y = y*D;
        
        if(X > Y){
            cout << Y << endl;
        }
        else{
            cout << X << endl;
        }
    }
}

C++: #include<iostream>
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>
#include <algorithm>
using namespace std;

int a, b, c, d, n;

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

C++: #include <iostream>
#include<algorithm>
#include<math.h>
using namespace std;
int main()
{
    double n,a,b,c,d;
    cin>>n>>a>>b>>c>>d;
    
 
    
    if(ceil(n/a)*b<ceil(n/c)*d){
        cout<<ceil(n/a)*b<<endl;
    }
    
    else
        cout<<ceil(n/c)*d<<endl;
    
    
    

    

    return 0;
}

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

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

    int x=0;
    int y=0;

    x=(N+(A-1))/A;
    y=(N+(C-1))/C;

    int a=0;
    int b=0;

    a=x*B;
    b=y*D;

    if(a<b){
        cout<<a<<endl;
    }else{
        cout<<b<<endl;
    }

return 0;

}

C++: #include<stdio.h>
int main(void)
{
	int x[2],n,a[2][2],i,k;
	scanf("%d",&n);
	for(i=0;i<2;i++)	scanf("%d %d",&a[i][0],&a[i][1]);
//for(i=0;i<2;i++) printf("%d %d\n",a[i][0],a[i][1]);
	for(i=0;i<2;i++){
		for(k=1;k<=n;k++){
			if(k*a[i][0]>=n){
				x[i]=k*a[i][1];
				break;
			}
		}
	}
//printf("aaa\n");
	if(x[0]<x[1]) printf("%d\n",x[0]);
	else printf("%d\n",x[1]);
	return 0;
}

C++: #include<iostream>
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"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"

using namespace std;

const long long int MOD = 1000000007;
const long double EPS = 1e-8;

long long int N, M, K, H, W, L, R;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);

	cin >> N >> L >> R >> H >> W;
	L = N / L + !!(N%L);
	L *= R;
	H = N / H + !!(N%H);
	H *= W;
	cout << min(L, H) << endl;
	return 0;
}

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

int main(){
    int N,A,B,C,D;
    cin>>N>>A>>B>>C>>D;
    int a=0,b=0,c=0,d=0;
    a=(N+A-1)/A;
    c=a*B;
    b=(N+C-1)/C;
    d=b*D;
    if(c<=d){
        cout<<c<<endl;
    }
    else if(c>d){
        cout<<d<<endl;
    }
    return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

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 na = n; if (n%a != 0)na += a - (n%a);
	int nc = n; if (n%c != 0)nc += c - (n%c);
	cout << min(b*na / a, d*nc / c) << endl;
	return 0;
}