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 "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"

using namespace std;

const long long int MOD = 1000000007;
const long double EPS = 1e-8;

long long int N, M, K, H, W, L, R;

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

	cin >> N >> L >> R >> H >> W;
	L = N / L + !!(N%L);
	L *= R;
	H = N / H + !!(N%H);
	H *= W;
	cout << min(L, H) << endl;
	return 0;
}

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

int main(){
    int N,A,B,C,D;
    cin>>N>>A>>B>>C>>D;
    int a=0,b=0,c=0,d=0;
    a=(N+A-1)/A;
    c=a*B;
    b=(N+C-1)/C;
    d=b*D;
    if(c<=d){
        cout<<c<<endl;
    }
    else if(c>d){
        cout<<d<<endl;
    }
    return 0;
}

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

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<iostream>
#include<algorithm>
using namespace std;
int main() {
	int n, a, b, c, d; cin >> n >> a >> b >> c >> d;
	int na = n; if (n%a != 0)na += a - (n%a);
	int nc = n; if (n%c != 0)nc += c - (n%c);
	cout << min(b*na / a, d*nc / c) << endl;
	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;
  if(n%a!=0) x=n/a+1;
  else x=n/a;
  if(n%c!=0) y=n/c+1;
  else y=n/c;
  cout<<min(x*b,y*d)<<endl;
}

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

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

using namespace std;

int cunting(int cunt,int n){
  int t;
  t = 0;
  int i;
  for( i = 0;t < n;i++){
    t += cunt;
  }
  return i;
}

typedef struct{
  int num;
  int value;
}pencil;

int main(){
  pencil a1;
  pencil a2;
  int N;

  cin >> N;
  cin >> a1.num >> a1.value;
  cin >> a2.num >> a2.value;

  int c1,c2;

  c1 = cunting(a1.num,N);
  c2 = cunting(a2.num,N);


  cout << min(a1.value*c1,a2.value*c2) << 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/C + 2; ++i){
    for(int k=0; k<N/A + 2; ++k){
      honsu += A;
      kane += B;
      ++counter;
      if(honsu >= N){
	if(!first_f){
	  first_f = true;

	  min = kane;
	  break;
	}else{
	  if(min > kane){
	    min = kane;
	  }
	  break;
	}
      }
    }
    honsu -= counter * A;
    honsu += C;
    kane -= counter * B;
    kane += D;
    counter = 0;

    if(honsu >= N){
      if(min > kane){
        min = kane;
      }
      break;
    }
  }

  cout << kane << 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) * B;
    if (N % A) x += B;

    y = (N / C) * D;
    if (N % C) y += D;

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

    return 0;
}

C++: #include <iostream>

int main(){
    int N,A,B,C,D;
    std::cin>>N>>A>>B>>C>>D;
    
    int X=N/A;
    if(N%A!=0) X++;
    int Y=N/C;
    if(N%C!=0) Y++;  

    X=X*B;
    Y=Y*D;
    if(X<=Y) std::cout<<X<<"\n";
    else std::cout<<Y<<"\n";

    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("B*x\n");}
else{printf("D*y\n");}
return 0;
}

C++: #include<iostream>
int main()
{
	int N, A, B, C, D;
	std::cin >> N >> A >> B >> C >> D;
	int ans1, ans2;
	if (N%A != 0) {
		ans1 = (N / A + 1)*B;
	}
	else if(N%A==0){
		ans1 = N / A * B;
	}
	if (N%C != 0) {
		ans2 = (N / C + 1)*D;
	}
	else if(N%C==0){
		ans2 = N / C * D;
	}
	if (ans1 > ans2) {
		std::cout << ans2 << std::endl;
	}
	else if (ans2 > ans1) {
		std::cout << ans1 << std::endl;
	}
	else {
		std::cout << ans1 << std::endl;
	}
	return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
	int N,A,B,C,D,a,b;
	cin>>N>>A>>B>>C>>D;
	a=N/A*B+B;
	b=N/C*D+D;
	if(a<b){
		cout<<a<<endl;
	}else{
		cout<<b<<endl;
	}
	return 0;
}

C++: #include<algorithm>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<functional>
#include<iomanip>
#include<iostream>
#include<list>
#include<map>
#include<queue>
#include<random>
#include<set>
#include<stack>
#include<string>
#include<utility>
#include<vector>

#define FOR(i,a,b) for(long long i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define FORR(i,a,b) for(long long i=(a);i>=(b);--i)
#define REPR(i,n)   FORR(i,n,0)

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll>pll;

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

    int ans;
    ans=(N+A-1)/A*B;
    ans=min(ans,(N+C-1)/C*D);

    cout<<ans<<endl;
	
	
	return 0;
}

C++: #include <bits/stdc++.h>
#define range(i, a, b) for(int i = (a); i < (b); i++)
#define rep(i, a) range(i, 0, a)
using namespace std;

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

    cout << min((n / a + (n % a != 0)) * b, (n / c + (n % c != 0)) * d) << endl;
    return 0;
}

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 = true;
  int kane = 0;
  int honsu = 0;
  for(int i=1; i<N/C + 1; ++i){
    int k;
    for(k=1; k<N/A + 1; ++k){
      honsu += A;
      kane += B;
      if(honsu >= N){
	if(first_f){
	  first_f = false;

	  min = kane;
	  break;
	}else{
	  if(min > kane){
	    min = kane;
	  }
	  break;
	}
      }
    }
    honsu -= k * A;
    honsu += C;
    kane -= k * B;
    kane += D;

    if(honsu >= N){
      if(min > kane){
        min = kane;
      }
      break;
    }
  }

  cout << min << endl;
  return 0;
}

C++: #include<iostream>
int main(){
    int n,a,b,c,d;
    std::cin>>n>>a>>b>>c>>d;
    
    int cnt1,cnt2,pri1,pri2;
    if(n%a==0){
        cnt1=n/a;
        pri1=cnt1*b;
    }else{
        cnt1=(n/a)+1;
        pri1=cnt1*b;
    }
    if(n%c==0){
        cnt2=n/c;
        pri2=cnt2*d;
    }else{
        cnt2=(n/c)+1;
        pri2=cnt2*d;
    }
    if(pri1<=pri2){
        std::cout<<pri1<<"\n";
    }else{
        std::cout<<pri2<<"\n";
    }
    return 0;
}

C++: #include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <map>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define pb push_back
#define rep(i, a, n) for(int i = (a); i < (n); i++)
#define dep(i, a, n) for(int i = (a); i >= (n); i--)
#define mod (ll)(1e9+7)
#define int ll

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

signed main() {
  int n, a, b, c, d;
  cin >> n >> a >> b >> c >> d;
  int h = 0, sk = 0, tk = 0;
  while(h < n) h += a, sk += b;
  h = 0;
  while(h < n) h += c, tk += d;
  cout << min(sk, tk) << endl;
}