Go: package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
	"strings"
)

var scanner = bufio.NewScanner(os.Stdin)

func nextString() string {
	scanner.Scan()
	return scanner.Text()
}

func nextInt() (int, error) {
	return strconv.Atoi(nextString())
}

func nextFloat64() (float64, error) {
	return strconv.ParseFloat(nextString(), 64)
}

func stringifyArray(arr []int) string {
	return strings.TrimRight(fmt.Sprintf("%+v", arr)[1:], "]")
}

func min(x, y int) int {
	if x < y {
		return x
	}
	return y
}
func main() {
	scanner.Split(bufio.ScanWords)

	n, _ := nextInt()
	a, _ := nextInt()
	b, _ := nextInt()
	c, _ := nextInt()
	d, _ := nextInt()

	costX := b * int(math.Ceil(float64(n)/float64(a)))
	costY := d * int(math.Ceil(float64(n)/float64(c)))
	fmt.Println(min(costX, costY))
}

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

int main(){

	int answer;
	int a,b,c,d,n;

	cin >> n >> a >> b >> c >> d;
	
	int X = ((n - 1) / a + 1) * b;
	int Y = ((n - 1) / c + 1) * d;

	cout << min(X, Y) << endl;


	/*
	int datanum = 0;
	for(int dataset = 0; dataset < 1; dataset++){
		if(input == 0) break;


		answer[dataset] = sum;

		datanum++;
	}

	for(int dataset = 0; dataset < datanum; dataset++){
		cout << answer[dataset] << endl;
	}
	*/

	

	return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<string>
#include<vector>

using namespace std;

int main(){
	int N;
	int a,b,c,d;
	int tp1,tp2;
	
	scanf("%d",&N);
	scanf("%d %d %d %d",&a,&b,&c,&d);
	tp1=N/a;
	if(N%a!=0)
	tp1++;
	tp2=N/c;
	if(N%c!=0)
	tp2++;
	printf("%d\n",min(tp1*b,tp2*d));
}

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

int n, a, b, c, d;

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

C++: #include<iostream>
using namespace std;
 
int N, A, B, C, D;
int X_SET,Y_SET,X_SUM,Y_SUM;

int main(){
   
cin>>N>>A>>B>>C>>D;
  
X_SET = N / A;
	if( N % A > 0) X_SET = X_SET + 1 ;

Y_SET = N / C;
	if( N % C > 0) Y_SET = Y_SET + 1 ;

X_SUM = B * X_SET;
Y_SUM = D * Y_SET;

	if( X_SUM < Y_SUM ) cout<< X_SUM <<endl;
	else 
 	cout<< Y_SUM <<endl;

  return 0;
}

C++: #include <iostream>
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>
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!=1) x++;
    x=x*c;

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

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

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;

    cin >> N >> A >> B >> C >> D ; //変数の読み込み

    // セットXで揃えた場合の必要セット数(Xset)を求める
    if( N % A == 0){
        Xset = N / A ;
    }else{
        Xset = N / A + 1 ;
    }

    // セットXで揃えた場合の合計金額を求める
    Xprice = Xset * B ;


    // セットYで揃えた場合の必要セット数(Yset)を求める

    if( N % C == 0){
        Yset = N / C ;
    }else{
        Yset = N / C + 1 ;
    }

    // セットXで揃えた場合の合計金額を求める
    Yprice = Yset * D ;

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

 return 0;

 }

 // 注：割り算の繰上げはceilでもできる

C++: #include<cstdio>
#include<algorithm>
#include<iostream>
using namespace std;
int main(void){
	int N,A,B,C,D,AB,CD;
	cin>>N>>A>>B>>C>>D;
	AB=N/A*B;
	if(N%A!=0){
		AB+=B;
	}
	CD=N/C*D;
	if(N%C!=0){
		CD+=D;
	}
	if(CD>AB){
		cout<<AB<<endl;
	}
	else{
		cout<<CD<<endl;
	}
	return 0;
}

C++: #include<stdio.h>
int main()
{
	int n,a,b,c,d,x,y;
	scanf("%d%d%d%d%d",&n,&a,&b,&c,&d);
	if(n%a==0){
		x=n/a*b;
	}else{
		x=(n/a+1)*b;
	}
	if(n%c==0){
		y=n/c*d;
	}else{
		y=(n/c+1)*d;
	}
	if(x<y){
		printf("%d\n",x);
	}else{
		printf("%d\n",y);
	}
	return 0;
}

C++: #include <iostream>

using namespace std;

int main()
{ int N,a,b,c,d,x,y,s,t;
  cin>>N>>a>>b>>c>>d;
  s=N/a;
  t=N/c;
  if(N%a==0){
    x=s*b;
  }else{x=s*b+b;
  }
  if(N%c==0){
    y=t*d;
  }else{
  y=t*d+d;}
  if(x>y){
    cout<<y<<endl;
  }else{
  cout<<x<<endl;}

    return 0;
}

C++: #include<stdio.h>
#include<string.h>
int main(void)
{	
	int n,x,y,a,b,c,d;
	scanf("%d",&n);
	scanf("%d",&a);
	scanf("%d",&b);
	scanf("%d",&c);
	scanf("%d",&d);
	x=n/a*b;
	y=n/c*d;
	if(n/a>0){
		x=x+b;
	}
	if(n/c>0){
		x=x+d;
	}
	if(x<y){
		printf("%d\n",x);
	}
	else{
		printf("%d\n",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 = (N + A - 1) / A * B;
    int y = (N + C - 1) / C * D;

    cout << min(x, y) << endl;
}

C++: #include<iostream>

int main()
{
  int a,b,c,d,n;
  std::cin >> n >> a >> b >> c >> d;
  std::cout << std::min(((n-1)/a+1)*b,((n-1)/c+1)*d) << std::endl;
  return 0;
}

C++: int main(){
    // test
}

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

using namespace std;
int main() {
    int n;
    int a;
    int b;
    int c;
    int d;
    int sum = 0;
    int max_v = 0;

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

    int x = (n-1)/a + 1;
    int y = (n-1)/c + 1;


    cout << min(x*b, y*d) <<endl;

    return 0;
}

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