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>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
#define MOD 1000000007
#define INF (1 << 30)
#define REP(i, m, n) for(int i = (int)m; i < (int)n; ++i)
#define rep(i, n) REP(i, 0, n)


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

    int n, a, b, c, d; cin >> n >> a >> b >> c >> d;
    int A = ((n+a-1)/a)*b;
    int B = ((n+c-1)/c)*d;
    cout << min(A, B) << '\n';
    return 0;
}

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

using namespace std;

int main(){
    int n;
    int a;
    int b;
    int c;
    int d;
    cin >> n >> a >> b >> c >> d;
    int x = (n + (a - 1)) / a * b;
    int y = (n + (c - 1)) / 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 AN = N/A+1;
    if(N%A==0)AN--;
    int CN = N/C+1;
    if(N%C==0)CN--;
    cout << min(AN*B,CN*D) << endl;
    return 0;
}

C++: #include <iostream>

using namespace std;

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

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

    int an = 0, cn = 0;
    int tmp = n;

    while (tmp > 0) {
        an += b;
        tmp -= a;
    }

    tmp = n;

    while (tmp > 0) {
        cn += d;
        tmp -= c;
    }

    cout << (an < cn ? an : cn) << endl;

}

C++: #include <iostream>
#include <string>
#include <cstring>
#include <fstream>
#include <cmath>
#include <iomanip>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <map>
#include <deque>
#include <map>
#include <set>
#include <queue>
#include <stack>

using namespace std;

int main() {
    

    int n,a,b,c,d;
    cin >> n >> a >> b >> c >> d;
    long ans1;
    long ans2;
    if(n%a == 0){
        ans1 = n/a * b;
    }else{
        ans1 = (n/a+1) * b;
    }
    if(n%c == 0){
        ans2 = n/c*d;
    }else{
        ans2 = (n/c+1)*d;
    }
    cout << min(ans1,ans2) << endl;

}

C++: #include<bits/stdc++.h>
using namespace std;
using Int = long long;
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++: #include<iostream>
#include<cmath>
#include<algorithm>
using namespace std;
int main(){
    
    
    int a,b,c,d,p,e,n,f,x,y,z;
    
    cin>>n>>a>>b>>c>>d;
    
    if(n%a==0){
        x=n/a;
    }
    else if(n%a>0){
        x=n/a+1;
    }
    if(n%c==0){
        y=n/c;
    }
    else if(n%c>0){
        y=n/c+1;
    }
    
    z=min(x*b,y*d);
    cout<<z<<endl;
    
    return 0;
}

C++: #include <iostream>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <map>
#include <queue>
using ll = long long;
using namespace std;

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

    int t = (N % A == 0) ? N / A * B : (N / A + 1) * B;
    int tt = (N % C == 0) ? N / C * D : (N / C + 1) * D;

    cout << min(t, tt) << endl;
    return 0;
}

C++: // Pencils 2018/12/27

#include <cstdio>
using namespace std;

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

    scanf("%d %d %d %d %d", &N, &A, &B, &C, &D);

    x = (N / A + N % A) * B; // 円
    y = (N / C + N % C) * D; // 円

    if (x <= y) printf("%d\n", x);
    else printf("%d\n", y);

    return 0;
}

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

int main() {
int N,A,B,C,D,E,F,G,H;
cin >> N >> A >> B >> C >> D;
   E = (N/A)*B;
   F = (N/C)*D;
   if(E>0&&F>0){
   if(A>C && B>D){
        G = E+B;
       cout<< G <<endl;
  } 
 
   if(A>C && B<D){
     G = E+B;
       cout<< G <<endl;
  } 
   if(A>C && B==D){
      G = E + B;
        cout<< G << endl;
  } 
  if(A<C && B>D){
       H = F+D;
       cout<< H <<endl;
 } 
   if(A<C && B<D){
        H = F+D;
       cout<< H <<endl;
    }
  if(A<C && B==D){
       H = F+B;
       cout<< H <<endl;
  } 
  
 }
  return 0;

}

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

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,a,b,c,d;
    cin >> n >> a >> b >> c >> d;
    int q=0,w=0;
    if(n%a>0){q=1;}
    if(n%c>0){w=1;}
    cout << min((b*((n/a)+q)),(d*((n/c)+w))) << endl;

    return 0;
}

C++: #include<iostream>
#include<cstdio>
int main(void)
{
	int N,A,B,C,D,a,b;
	scanf("%d %d %d %d %d",&N,&A,&B,&C,&D);
	if(N%A!=0)
	{
		a=(N/A+1)*B;
	}
	else
	{
		a=(N/A)*B;
	}
	if(N%C!=0)
	{
		b=(N/C+1)*D;
	}
	else
	{
		b=(N/C)*D;
	}
	if(a>b){a=b;}
	printf("%d\n",a);
	return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <sstream>
#include <cstdlib>
using namespace std;
int main(){
	int i,o,s,t,r,e=1,a=1,m,q;
	cin>>i>>o>>s>>t>>r;
	m=o;
	q=t;
	while(i>m){
		e++;
		m=m+o;
	}
	while(i>q){
		a++;
		q=q+t;
	}
	s=s*e;
	r=r*a;
	if(s<=r){
		cout<<s;
	}else{
		cout<<r<<endl;
	}
return 0;
}

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

int n, a, b, c, d;

int main(){
  
  cin>>n>>a>>b>>c>>d;
  
  int v1 = n/a*b;
  if(n%a) v1+=b;
  
  int v2 = n/c*d;
  if(n%c) v2+=d;

  cout<<min(v1, v2)<<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)a=n/a;
	else a=n/a+1;
	b=b*a;
	if(n%c==0)c=n/c;
	else c=n/c+1;
	d=c*d;
	if(b<d)swap(b,d);
	cout<<d<<endl;

	return 0;
}

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

#define REP(i,n) for(int i=0;i<(n);i++)
#define REAP(i,a,n) for(int i=(a);i<(n);i++)
#define YES cout<<"Yes"<<endl
#define NO cout<<"No"<<endl
#define fr first
#define sc second
#define pb push_back
#define All(v) v.begin(),v.end()
typedef long long ll;

int main(){
    int n,a,b,c,d;
    cin >> n >> a >> b >> c >> d;
    int x=(n/a)*b;
    if(n%a)x+=b;
    int y=(n/c)*d;
    if(n%c)y+=d;
    cout << min(x,y) << endl;
}

C++: //JOI2018 1 Pencils
//20181208
//F_Naru
#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;

int main(){
	int N, A, B, C, D, x, y, i = 1, ans;
	cin>>N>>A>>B>>C>>D;
	
	while(1){
		if(A * i >= N) {
			x = B * i;
			break;
		}
		i++;
	}
	i = 1;
	while(1){
		if(C * i >= N) {
			y = D * i;
			break;
		}
		i++;
	}
	if(x > y) ans = y;
	else ans = x;
	
	cout<<ans<<endl;
	return 0;
}

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

int main() {
    int n, a, b, c, d, sa, sc;
    std::scanf("%d %d %d %d %d", &n, &a, &b, &c, &d);
    sa = (n % a == 0) ? n / a : n /a + 1;
    sc = (n % c == 0) ? n / c : n /c + 1;
    (sa * b <= sc * d) ? printf("%d\n", sa * b) : printf("%d\n", sc * d);
    return 0;
}

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

int N,A,B,C,D,F,Z,L,P;

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

int x;
int y;

if( N % A == 0)
F= N / A ; //FはXの個数
else
F= N / A + 1 ; 

if( N % C == 0)
L= N / C ; //LはYの個数
else
L= N / C + 1; //LはYの個数

Z=B*F; //ZはXで揃えた場合の合計金額
P=L*D; //PはYで揃えた場合の合計金額
 //set x   F=N/A+1 Z=B*F
 //set y   L=N/C+1 P=L*D

 if (Z<P)
cout<<Z<<endl;
 else
cout<<P<<endl;

return 0;
}

C++: //18-1 鉛筆
#include<iostream>
#include<stdio.h>
#include<math.h>
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;
    return 0;
}