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 <bits/stdc++.h>
#define int long long int
using namespace std;
template<typename T,typename U> using P=pair<T,U>;
template<typename T> using V=vector<T>;
template<typename T>bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<typename T>bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}

template<typename T>auto&operator<<(ostream&s,const vector<T>&v){s<<"[";bool a=1;for(auto e:v){s<<(a?"":" ")<<e;a=0;}s<<"]";return s;}
template<typename T,typename U>auto&operator<<(ostream&s,const pair<T,U>&p){s<<"("<<p.first<<","<<p.second<<")";return s;}
template<typename T>auto&operator<<(ostream&s,const set<T>&st){s<<"{";bool a=1;for(auto e:st){s<<(a?"":" ")<<e;a=0;}s<<"}";return s;}
template<typename T,typename U>auto&operator<<(ostream&s,const map<T,U>&m){s<<"{";bool a=1;for(auto e:m){s<<(a?"":" ")<<e.first<<":"<<e.second;a=0;}s<<"}";return s;}
#define DUMP(x)  cerr<<#x<<" = "<<(x)<<endl;

struct edge { int to, cost; };

const int INF = 1e18;
const int MOD = 1e9+7;

signed 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++: // http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0641


#include<iostream>
 using namespace std; //標準名前空間を使用

int main(){

    //変数を読み込む
    int N , A , B ,C ,D ;
    int Xset , Yset , Xprice , Yprice;

    // セットXで揃えた場合の必要セット数(Xset)を求める
    Xset = N / A + 1 ;
    // セットXで揃えた場合の合計金額を求める
    Xprice = Xset * B ;


    // セットYで揃えた場合のの必要セット数(Yset)を求める
    Yset = N / C + 1 ;
    // セットXで揃えた場合の合計金額を求める
    Yprice = Yset * D ;

    //XpriceとYpriceを比較する
    if(Xprice < Yprice){
    cout << Xprice ; //XpriceがYpriceより小さい場合、Xpriceを出力
    }else{
    cout << Yprice ; //そうでない場合、Ypriceを出力
    }

 return 0;

 }

C++: /////////////////////////////////////////////////////////
//
//  c/temp.cpp file
//  last updated: 2018-10-23 ...maybe
//
//    i hope you adding this code to the setting file
//    alias g++='g++ -std=c++1y -ddebug_local'
//
/////////////////////////////////////////////////////////

#include <bits/stdc++.h>

using namespace std;

#define fi first
#define se second
#define mp make_pair
#define pb push_back

//#define int long long

#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) reap(i,0,n)
#define reap(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__va_args__,reap,_rep,)(__va_args__)

#define _repr(i,n) reapr(i,n,0)
#define reapr(i,a,b) for(int i=int(a-1);i>=int(b);--i)
#define repr(...) _overload3(__va_args__,reapr,_repr,)(__va_args__)

#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()

#define coutall(a) {int loop_coutall=0;for(auto e:a) cout<<(loop_coutall++?" ":"")<<e; cout<<endl;}

#define coutyn(a) cout<<((a)?"yes":"no")<<endl;
#define coutyn(a) cout<<((a)?"yes":"no")<<endl;
#define coutyn(a) cout<<((a)?"yes":"no")<<endl;

#define pcnt __builtin_popcount
#define buli(x) __builtin_popcountll(x)

const int inf=1145141919;
//const long long inf=114514191911451419;
const int mod=(int)1e9+7;
const double eps=1e-12;
const int dx[]={1,0,-1,0},dy[]={0,1,0,-1};
//const int dx[]={-1,-1,-1,0,1,1,1,0},dy[]={-1,0,1,1,1,0,-1,-1};

using vi=vector<int>;
using vvi=vector<vi>;
using vs=vector<string>;

typedef pair<int,int> pii;
typedef pair<int,string> pis;
typedef pair<string,int> psi;
typedef pair<string,string> pss;

typedef long long ll;

template<typename t> istream &operator >> (istream &is, vector<t> &v){for(t &x:v) is>>x;return is;}
template<typename t> ostream &operator << (ostream &os, vector<t> &v){int i=0;for(t &x:v) os<<(i++?" ":"")<<x;return os;}

ll rev(ll n){ll x=0;for(;n>0;){x=x*10+n%10;n/=10;}return x;}

ll upper(ll n,ll m){return (n+m-1)/m;};
ll rounding(ll n){return (long double)n+0.5;};

bool ing(ll x,ll n){return 0<=x && 0<n;}
bool outg(ll x,ll n){return x<0 || n<=x;}

inline int qp(int a,ll b){if(!b)return 1;int ans=1;do{if(b&1)ans=1ll*ans*a;a=1ll*a*a;}while(b>>=1);return ans;}
inline int qp(int a,ll b,int mo){if(!b)return 1;int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}

inline ll fac(ll k,ll n){ll a=1;for(int i=0;i<n;i++)a*=k--;return a;}
inline ll fac(ll k,ll n,int mo){ll a=1;for(int i=0;i<n;i++)a*=k--,a%=mo;return a;}

inline int dsum(ll n){int a=0;for(;n;n/=10)a+=n%10;return a;}

struct arithmetic{arithmetic(){cin.tie(0);ios::sync_with_stdio(0);cout<<fixed<<setprecision(20);}};

//#define debug_local

#ifdef debug_local
template<typename t> void deb(t a){cerr<<"deb: "<<a<<"です"<<endl;}
#define debl {cerr<<"debug: "<<__line__<<"行目だ"<<endl;}
void what_cr(){cout<<__gcc_atomic_char16_t_lock_free<<" ←？"<<endl;}
//ori_func s

//ori_func e
#else
template<typename t>void deb(t a){}
#define debl
void what_cr(){}void t_t(){}
#endif

signed main(){

  arithmetic exception;

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

  cout<<min(upper(n,a)*b,upper(n,c)*d)<<endl;

  return 0;

}

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

template<class T> inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template<class T> inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
int ctoi(char c) {
  if (c >= '0' && c <= '9') {
    return c - '0';
  }
  return 0;
}
ll factorial(ll n) {
  if (n == 1) {
    return 1;
  }
  ll ans = factorial(n-1);
  return ans*n;
}
ll gcd(ll a, ll b) {
  if (b == 0) return a;
  return gcd(b, a%b);
}
ll lcm(ll a, ll b) {
  return (a/gcd(a, b))*b;
}
bool is_prime(ll n) {
  for (ll i = 2; i*i <= n; i++) {
    if (n%i == 0) return false;
  }
  return n != 1;
}
ll mod_pow(ll x, ll n, ll mod) {
  if (n == 0) return 1;
  ll res = mod_pow(x*x%mod, n/2, mod);
  if (n & 1) res = res * x % mod;
  return res;
}

int main() {
  ll n, a, b, c, d;
  cin >> n >> a >> b >> c >> d;
  ll res1, res2;
  if (n%a == 0) {
    res1 = (n/a)*b;
  } else {
    res1 = (n/a)*b + b;
  }
  if (n%c == 0) {
    res2 = (n/c)*d;
  } else {
    res2 = (n/c)*d + d;
  }
  cout << min(res1, res2) << endl;
}

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

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

#define FOR( i, m, n )  for( int (i) = (m); (i) < (n); (i)++ )
#define REP( i, n )     FOR( i, 0, n )
#define ALL( a )        (a).begin(), (a).end()             


int main(void){
    int n, a, b, c, d; cin >> n >> a >> b >> c >> d;
    
    int tmp[2];
    if( n % a == 0 ) tmp[0] = n / a * b;
    else             tmp[0] = ( n / a + 1 ) * b;
    
    if( n % c == 0 ) tmp[1] = n / c * d;
    else             tmp[1] = ( n / c + 1 ) * d;

    
    cout << min( tmp[0], tmp[1] ) << endl;
}

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

int main(){

  int N,A,B,C,D;
  int sum1=0,sum2=0,ans1,ans2;;

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

  while(1){
    sum1=sum1+A;
    sum2=sum2+B;
    // if(sum1==N){sum2=sum2-B; break; }
    if(sum1>=N){ break; }

  }

  ans1=sum2;


  sum1=0; sum2=0;



 while(1){
    sum1=sum1+C;
    sum2=sum2+D;

    // if(sum1==N){ sum2=sum2-D; break; }
if(sum1>=N){ break; }
  }




  ans2=sum2;
  if(ans1<ans2){
  cout<<ans1<<endl;
  }

  if(ans1>=ans2){
  cout<<ans2<<endl;
  }

  return 0;
}