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

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

using namespace std;

#define int long long
#define all(v) (v).begin(), (v).end()
#define resz(v, ...) (v).clear(), (v).resize(__VA_ARGS__)
#define reps(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep(i, n) reps(i, 0, n)

template<class T1, class T2> void chmin(T1 &a, T2 b){if(a>b)a=b;}
template<class T1, class T2> void chmax(T1 &a, T2 b){if(a<b)a=b;}

using Pi = pair<int, int>;
using Tapris = tuple<int, int, int>;
using vint = vector<int>;

const int inf = 1LL << 55;
const int mod = 1e9 + 7;

signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  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>
using namespace std;
int main(){
  int sum,a,am,b,bm,x,y;
  cin>>sum;
  cin>>a>>am;
  cin>>b>>bm;
  if(sum%a==0){
    x=sum/a*am;
  }
  else{
    x=(sum/a+1)*am;
  }
  

  if(sum%b==0){
      y=sum/b*bm;
  }
  else{
    y=(sum/b+1)*bm;
  }
if(x>=y){
  cout<<y<<endl;
 }
 else{
   cout<<x<<endl;
 }


}

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

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<< F << endl;
  }
  if(A<C && B>D){
       cout<< F <<endl;
  } 
 
 }

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

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

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

  if(n % a == 0)
    {
      cout << (n/a)*b << endl;
    } 
  else if(n % c == 0)
    {
      cout << (n/c)*d << endl;
    }
  else
    {
      num1= (n/a)+1;
      num2= (n/c)+1;
      if(num1*b < num2*d)
	{
	  cout << num1*b << endl;
	}
      else
	{
	  cout << num2*d << endl;
	}
    }
}

C++: int main(){
    //test
    
}