Go: package main

import (
	"fmt"
	"os"
	"strconv"
	"bufio"
	"strings"
)
func main2(){
ans(10,3,50,4,60)
ans(10 ,3, 100, 5, 180)//360
ans(6, 2, 200, 3, 300)// 600

}

func main() {



    sc := bufio.NewScanner(os.Stdin)
     sc.Scan()
        args := strings.Split(sc.Text(), " ")
      

	var n, a, b, c, d int

	n, _ = strconv.Atoi(args[0])
	a, _ = strconv.Atoi(args[1])
	b, _ = strconv.Atoi(args[2])
	c, _ = strconv.Atoi(args[3])
	d, _ = strconv.Atoi(args[4])

        ans(n,a,b,c,d)
}

func ans(n,a,b,c,d int){

	ans2 := 0
	for i := 0; i < 1000; i++ {
		if i*a >= n {
			ans2 = i * b
			break
		}
	}

	for i := 0; i < 1000; i++ {
	
		if i*c >= n {
			if ans2 > i*d {


				ans2 = i *  d
			}
			break
		}
	}

	fmt.Printf("%d\n", ans2)
}

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

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

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