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;
#define int long long

int a, b, c, d, n;

signed main()
{
    cin >> n >> a >> b >> c >> d;
    printf("%lld\n", min(((n + a - 1) / a) * b, ((n + c - 1) / c) * d));


    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"
#define rep(i,a,n) for(int i = (a);i < (n);i++)
typedef unsigned long long ull;
typedef long long ll;
using namespace std;

int main(){
    int a,b,c,d,n,sum_a,sum_c;
    cin >> n >> a >> b >> c >> d;
    
    if(n % a == 0){
        sum_a = n/a*b;
    }
    else{
        sum_a = (n/a+1)*b;
    }
    
    if(n % c == 0){
        sum_c = n/c*d;
    }
    else{
        sum_c = (n/c+1)*d;
    }
    
        
    cout << min(sum_a,sum_c) << 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;
}

C++: #include <stdio.h>

int main(){
	int N,A,B,C,D;
	scanf("%d%d%d%d%d",&N,&A,&B,&C,&D);
	int ma = (N / A + (N%A != 0 ? 1 : 0)) * B;
	int mb = (N / C + (N%C != 0 ? 1 : 0)) * D;
	printf("%d\n",ma > mb ? mb : ma);
	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 << y << endl;
  else cout << x << endl;

  return 0;
}

C++: #include <iostream>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <algorithm>
#include <cmath>
#define rep(i,j,k) for(int i=(int)j;i<(int)k;i++)
using namespace std;

int main(void){
    int n;
    double a,b,c,d;
    cin>>n>>a>>b>>c>>d;
    
    int x1=ceil(n/a),x2=ceil(n/c);
    if(x1*b<x2*d)cout<<x1*b<<endl;
    else cout<<x2*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;
  
  if((N/A)*B <= (N/C)*D && N%A == 0 && N%C == 0 ) cout<<(N/A)*B<<endl;
  if((N/A+1)*B <= (N/C)*D && N%A > 0 && N%C == 0) cout<<(N/A+1)*B<<endl;
  if((N/A)*B >= (N/C+1)*D && N%C > 0 && N%A == 0 ) cout<<(N/C+1)*D<<endl;
  if((N/A+1)*B <= (N/C+1)*D && N%A > 0 && N%C > 0) cout<<(N/A+1)*B<<endl;
  if((N/A)*B > (N/C)*D && N%A == 0 && N%C == 0 ) cout<<(N/C)*D<<endl;
  if((N/A+1)*B > (N/C)*D && N%A > 0 && N%C == 0) cout<<(N/C)*D<<endl;
  if((N/A)*B < (N/C+1)*D && N%C > 0 && N%A == 0 ) cout<<(N/A)*B<<endl;
  if((N/A+1)*B > (N/C+1)*D && N%A > 0 && N%C > 0) cout<<(N/C+1)*D<<endl;

  return 0;
}

C++: #include<stdio.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("%f\n",B*x);}
    else{printf("%f\n",D*y);}

return 0;
}

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

using namespace std;
typedef long long ll;
typedef pair<int,int> P;

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

	int n,a,b,c,d,t1,t2;
	cin >> n >> a >> b >> c >> d;

	if(n%a == 0) t1 = n/a*b;
	else t1 = (n/a+1)*b;

	if(n%c == 0) t2 = n/c*d;
	else t2 = (n/c+1)*d;

	cout << min(t1,t2) << endl;

	return 0;

}

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

int main(){
    int ans=0,sum=0;
    int n;
    int a,b,c,d;
    
    cin >>n>>a>>b>>c>>d;

    //cout <<fixed<<setprecision(16)<< << endl;
    cout << min(b*((n+a-1)/a),d*((n+c-1)/c)) << endl;

    //if(flag==1)cout << "Yes" <<endl;
    //else cout << "No" <<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,n%c==0){
	if(n/a*b<=n/c*d){
		cout << n/a*b <<endl;
}
	else cout << n/c*d <<endl;
if (n%a==0,n%c!=0){
	if(n/a*b<=(n/c+1)*d){
		cout << n/a*b <<endl;
}
	else cout << (n/c+1)*d <<endl;
if (n%a!=0,n%c!=0){
	if((n/a+1)*b<=(n/c+1)*d){
		cout << (n/a+1)*b <<endl;
}
	else cout << (n/c+1)*d <<endl;
if (n%a!=0,n%c==0){
	if((n/a+1)*b<=n/c*d){
		cout << (n/a+1)*b <<endl;
}
	else cout << n/c*d <<endl;
}
}
}
}
return 0;
}

C++: #include <stdio.h>
int main(){
    int n,a,b,c,d,x,y;
    scanf("%d %d %d %d %d",&n,&a,&b,&c,&d);
    for(int i=1;;i++){
        if(n<=a*i){
            x=b*i;
            break;
        }
    }
    for(int j=1;;j++){
        if(n<=c*j){
            y=d*j;
            break;
        }
    }
    if(x<y){
        printf("%d\n",x);
    } else {
        printf("%d\n",y);
    }
}

C++: #include <iostream>
#include <math.h>
using namespace std;
int main(){
  int N,A,B,C,D;
  cin >> N >> A >> B >> C >> D;
  int X = (N % A != 0 ? N / A + 1 : N/A) * B;
  int Y = (N % C != 0 ? N / C + 1 : N/C) * D;
  cout << min(X,Y) << endl;
}

C++: #include<iostream>
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)*b;
	}
	else {
		x = (n / a)*b;
	}
	if (n%c > 0) {
		y = (n / c + 1)*d;
	}
	else {
		y = (n / c)*d;
	}
	cout << min(x, y) << endl;
	return 0;
}

C++: #include<iostream>
using namespace std;
int main(){

	int N,A,B,C,D,s,c,q,w;
	cin>>N>>A>>B>>C>>D;
		s=N/A;
		if(N%A>0){s=s+1;}
		c=N/C;
		if(N%C>0){c=c+1;}
		q=s*B;
		w=c*D;
		if(q<w){cout<<q<<endl;}
		else{cout<<w<<endl;}

	return 0;
}

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

int n, a, b, c, d;

int main() {
  scanf("%d%d%d%d%d", &n, &a, &b, &c, &d);
  int ans1 = n / a;
  if (ans1 * a != n) ans1++;
  int ans2 = n / c;
  if (ans2 * c != n) ans2++;
  printf("%d\n", min(ans1 * b, ans2 * d));
}

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

C++: #include<iostream>
using namespace std;
int main(void)
{
	int x=0,y=0,n,a,b,c,d;
	cin>>n>>a>>b>>c>>d;
	if(n%a!=0) x=b*(n/a+1);
	else x=b*(n/a);
	if(n%c!=0) y=d*(n/c+1);
	else y=d*(n/c);
	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(B * ceil(N * 1.0 / A), D * ceil(N * 1.0 / C)) << 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<bits/stdc++.h>
using namespace std;

int main(){
  int a,b,c,d,n,x,y;
  cin>>n>>a>>b>>c>>d;
  for(int i=0;i<n;){
    i+=a;
    if(i>=n){x=b*i/a;}
  }

  for(int i=0;i<n;){
    i+=c;
    if(i>=n){y=d*i/c;}
  }

  if(x>y){cout<<y<<endl;}
  else{cout<<x<<endl;}
  
  return 0;
}