Go: package main

import (
	"fmt"
	"math"
)

func price(wantNum int, setNum int, setPrice int) int {
	return int(math.Ceil(float64(wantNum)/float64(setNum))) * setPrice
}

func min(a int, b int) int {
	if a < b {
		return a
	}
	return b
}

func main() {
	var n, a, b, c, d int
	fmt.Scanf("%d %d %d %d %d", &n, &a, &b, &c, &d)

	var priceA = price(n, a, b)
	var priceB = price(n, c, d)
	var p = min(priceA, priceB)

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

C++: #include <iostream>
#include <algorithm>
using namespace std;
int n,a,b,c,d;
int main(void){
    cin>>n>>a>>b>>c>>d;
    cout<<min((n+a-1)/a*b,(n+c-1)/c*d)<<endl;
    
}

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

int main() {
    int n, a, b, c, d;
    cin >> n >> a >> b >> c >> d;
    printf("%d\n", ((n+(a-1))/a)*b < ((n+(c-1))/c)*d ? ((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,X,Y;
  cin>>N>>A>>B>>C>>D;
  X=N%A==0?N/A*B:(N/A+1)*B;
  Y=N%C==0?N/C*D:(N/C+1)*D;
  cout<<(X<Y?X:Y)<<endl;
  return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

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

    int x = (n+a-1)/a, y = (n+c-1)/c;
    cout << min(b*x, d*y) << endl;
    return 0;
}

C++: #include<iostream>
using namespace std;
int main(void){
    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 min( int a, int b )
{
    return a < b ? a : b;
}

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

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

    a = n % a == 0 ? n / a * b : ( n / a + 1 ) * b;
    c = n % c == 0 ? n / c * d : ( n / c + 1 ) * d;
    
    cout << min( a, c ) << 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 ans = min((N + A - 1) / A * B, (N + C - 1) / C * D);
  cout << ans << 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;
   return 0;
}

C++: #include <iostream>
#include <cmath>
#include <algorithm>
using namespace std;
int main(){
    int N,A,B,C,D,a,c;
    cin>>N>>A>>B>>C>>D;
    a=ceil((double)N/A)*B;
    c=ceil((double)N/C)*D;
    cout<<min(a,c)<<endl;
    return 0;
}

C++: #include <iostream>
#include <math.h>
#include <algorithm>

using namespace std;

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

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

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

	int setX, setY;
	if (N%A > 0) {
		setX = B * (N / A + 1);
	}
	else {
		setX = B * N / A;
	}
	if (N%C > 0) {
		setY = D * (N / C + 1);
	}
	else {
		setY = D * N / C;
	}

	if (setX > setY) {
		cout << setY << endl;
	}
	else if (setX < setY) {
		cout << setX << endl;
	}
	else {
		cout << setX << endl;
	}

	return 0;
}

C++: #include <iostream>
using namespace std;
int main(void){
    int n,a,b,c,d;
    int x,y;
    cin >> n,a,b,c,d;
    
    x=n/a;
    if(x!=0) x++;
    x=x*c;

    y=n/b;
    if(y!=0) y++;
    y=y*d;

    if(x<y){
     cout << x ;
    }else{
     cout << y ;
    }

return 0;
    
}

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

C++: #include <iostream>
using namespace std;
int main(void){
	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 main(){

	int N,A,B,C,D;
	
	cin >> N >> A >> B >> C >> D;
		
	int planA, planB;

	if(N % A == 0)
		planA = N / A * B;
	else
		planA = (N / A + 1) * B;

	if(N % C == 0)
		planB = N / C * D;
	else
		planB = (N / C + 1) * D;

	if(planA < planB)
		cout << planA << endl;
	else
		cout << planB << endl;

	/*
	int A,B,C,D,E;
	cin >> A >> B >> C >> D >> E;

	int answer;
	if(A < 0){
		answer = -A * C + D + B * E;
	}
	if(A > 0){
		answer = (B - A) * E;
	}
	cout << answer << 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;
  int ta,tc;
  if(n%a) ta=n/a*b+b;
  else ta=n/a*b;
  if(n%c) tc=n/c*d+d;
  else tc=n/c*d;
  cout << (ta<tc?ta:tc) << endl;
  
  return 0;
}

C++: #include<iostream>
#include<algorithm>
using namespace std;
main(){
  int n, a, b, c, d;
  cin >> n >> a >> b >> c >> d;

  int X = (n/a + (n%a>0?1:0))*b;
  int Y = (n/c + (n%c>0?1:0))*d;
  cout << min(X, Y) << endl;
}

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

int main() {
int N,A,B,C,D;
int Z,ZZ;
cin >> N >> A >> B >> C >> D;
if(N%A == 0){
	Z = N/A;
};
if(N%A != 0){
	Z = N/A + 1;
}
if(N%C == 0){
	ZZ = N/C;
};
if(N%C != 0){
	ZZ = N/C + 1;
};
if(Z*B <= ZZ*D){
	cout << Z*B << endl;
}
else if(Z*B > ZZ*D){
	cout << ZZ*D << endl;
}
return 0;
}

C++: #include<iostream>
#include<algorithm>
using namespace std;
int main() {
	int n, a, b, c, d,aa,bb,kin;
	cin >> n >> a >> b >> c >> d;
	aa = 0;
	kin = 0;
	while (aa < n) {
		aa = aa + a;
		kin =b + kin;
	}
	aa = kin;
	bb = 0;
	kin = 0;
	while (bb < n) {
		bb = bb + c;
		kin = d + kin;
	}
	bb = kin;
	cout << min(aa, bb) << endl;
}

C++: #include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>

using namespace std;

#define var auto
#define ll long long
#define FOR(i, a, b) for(int (i) = (a); (i) < (b); (i)++)
#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++) 
#define inp(a) int a; cin >> a;
#define inps(s) std::string s; cin >> s;
#define out(a) cout<<a<<endl;
#define pb(a) push_back((a))
#define endl "\n"
#define vi vector<int>


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

	int N, A, B, C, D;
    cin >> N >> A >> B >> C >> D;

    int n = N - 1;
    int x = n / A + 1;
    int y = n / C + 1;

    // cerr << n << endl << x << endl << y;
    cout << min(x * B, y * D) << 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;
	return 0;
}

C++: #include<stdio.h>
#include<math.h>
int main(void){
  int N,A,B,C,D,s,t;
    scanf("%d%d%d%d%d",&N,&A,&B,&C,&D);
    double x=ceil(N/A);
    double y=ceil(N/C);
    s=B*x;
    t=D*y;
    if (B*x <= D*y)
      {printf("%f\n",s);}
    else{printf("%f\n",t);}

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