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<cstdio>
#include<functional>
#include<algorithm>
using namespace std;
int main(void)
{
	int n,a,b,c,d,x,y,xm,ym,mn;
	scanf("%d %d %d %d %d",&n,&a,&b,&c,&d);
	x=n/a;	
	if(n%a!=0)	x++;
	xm=x*b;
	y=n/c;
	if(n%c!=0)	y++;
	ym=y*d;
	mn=min(xm,ym);
	printf("%d\n",mn);
	return 0;
}

C++: n,a,b,c,d = map(int,input().split())
print(min(((n-1)//a+1)*b,((n-1)//c+1)*d))

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

int main(){

    int N,A,B,C,D;
    cin>>N>>A>>B>>C>>D;
    int sum = 0;
    int sum1 = 0;
    for (int i=0;i<N;i=i+A){
       sum = sum+B;
    }
    for (int i=0;i<N;i=i+B){
       sum1 = sum1+D;
    }
    if(sum<=sum1){
      cout<<sum+B<<endl;
    } else {
      cout<<sum1+D<<endl;
    }
    return 0;
}

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


int main(void){
    // 自分の得意な言語で
    // Let's チャレンジ！！

    string str;
    int N, A, B, C, D;
    int count = 0;
    getline(cin, str);
    stringstream ss;
        ss << str;
        ss >> N;
        ss >> A;
        ss >> B;
        ss >> C;
        ss >> D;
    
    int timesX, timesY;
    timesX = N / A + (N % A != 0);
    timesY = N / C + (N % C != 0);
    
    int sumX, sumY;
    sumX =  B * timesX;
    sumY =  D * timesY;
    
    int ans;
    if(sumX < sumY)
    ans = sumX;
    else
    ans = sumY;
    
    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 - 1) / a + 1) * b, y = ((n - 1) / c + 1) * d;

	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(((n + a - 1) / a) * b, ((n + c - 1) / c) * d) << '\n';
}

C++: 
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <string>
#include <cstring>
#include <ctime>


using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

//math
//-------------------------------------------
template<class T> inline T sqr(T x) { return x*x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define EXISTch(s,c) ((((s).find_first_of(c)) != std::string::npos)? 1 : 0)//cがあれば1 if(1)
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  FOR(i,0,n)
#define loop(n) FOR(i,0,n)
#define rrep(i,a,b) for(int i=(a);i>=(b);--i)
//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = (int)1000000007;
const LL MOD = (LL)1000000007;//10^9+7
const LL INF2 = (LL)100000000000000000;//10^18

int ceil(int n, int d) {
	return (n + d - 1) / d;
}

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

	int ans = min(ceil(n, a)*b, ceil(n, c)*d);

	cout << ans << endl;

	return 0;
}

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

int main() {
	int N, A, B, C, D;
	cin >> N >> A >> B >> C >> D;
	cout << min((A - 1 + N) / A * B, (C - 1 + N) / C * D) << endl;
}

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

C++: #include <iostream>
#include <algorithm>

using namespace std;

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

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

	int p = 0,q = 0;

	for (int i = 0; i < n + 1; i++)
	{
		if (i * a >= n)
		{
			p = b * i;
			break;
		}
	}
	for (int i = 0; i < n + 1; i++)
	{
		if (i * c >= n)
		{
			q = d * i;
			break;
		}
	}

	cout << min(p,q) << endl;
}

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


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

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

  bool first_f = false;
  int kane = 0;
  int honsu = 0,counter = 0;
  for(int i=0; i<N/A + 1; ++i){
    for(int k=0; k<N/C + 1; ++k){
      honsu += A;
      kane += B;
      ++counter;
      if(honsu >= N){
	if(!first_f){
	  first_f = true;

	  min = kane;
	}else{
	  if(min > kane){
	    min = kane;

	    break;
	  }
	}
      }
    }
    honsu -= counter * A;
    honsu += C;
    kane -= counter * B;
    kane += D;
    counter = 0;
  }

  cout << kane / 2 << endl;
  return 0;
}

C++: #include<iostream>
using namespace std;
#define INF 100000000
int main(){
  int N,pen,kati;
  cin >> N ;
  int ans = INF;
  for(int i=0;i<2;i++){
    cin >> pen >> kati;
    int a = N / pen;
    if(N%pen>=1) a++;
    ans = min(ans,a*kati);
  }
  cout << ans << endl;
}

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

C++: #include <bits/stdc++.h>
using namespace std;
int main(){
  int n,a,b,c,d,i=1,x,k,k1,k2,j=1,I,J;
    cin>>n>>a>>b>>c>>d;  
    if(n%a==0){
      k1=n/a;
    }
    else {
       k1=n/a+1;
    }
    if(n%c==0){
      k2=n/c;
    }
    else{
      k2=n/c+1;
    }
  if(k1*b==k2*d){
    cout<<k1*b<<endl;
  }
  else if(k1*b>k2*d){
    cout<<k2*d<<endl;
  }
  else {
    cout<<k1*b<<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)*b;
  int Y = (n/c + n%c)*d;
  cout << min(X, Y) << endl;
}

C++: #include<bits/stdc++.h>
using namespace std;
int main(){
  int n,a,b,c,d;
  cin>>n>>a>>b>>c>>d;
  int ans=0;
  for(int i=0;1;i++){
    for(int j=0;1;j++){
      if(j*c+i*a>=n){
	if(ans==0) ans=i*b+j*d;
	else if(ans>i*b+j*d) ans=i*b+j*d;
	break;
      }
    }
    if(i*a>n) break;
  }
  cout<<ans<<endl;
  return 0;
}