Go: package main

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

var scanner = bufio.NewScanner(os.Stdin)

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

func nextInt() int {
	n, err := strconv.Atoi(nextString())
	if err != nil {
		fmt.Printf("strconv.Atoi failed: %v\n", err)
	}
	return n
}

func min(x, y int) int {
	if x < y {
		return x
	}
	return y
}

func main() {
	scanner.Split(bufio.ScanWords)

	a := nextInt()
	b := nextInt()
	c := nextInt()
	d := nextInt()
	p := nextInt()

	priceA := a * p
	priceB := 0
	if p <= c {
		priceB = b
	} else {
		priceB = b + (p-c)*d
	}
	fmt.Println(min(priceA, priceB))
}

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

C++: #include<iostream>
using namespace std;
int minnum(int x,int y);
int main(){
    int data[5] = {0};
    int ansX = 0;
    int Yover = 0;
    int ansY = 0;
    for(int i = 0;i < 5;i++){
        cin >> data[i];
    }
    ansX = data[0] * data[4];
    Yover = data[4] - data[2];
    if(Yover < 0){
        Yover = 0;
    }
    ansY = data[1] + (Yover * data[3]);
    int ans = minnum(ansX,ansY);
    cout << ans << endl;
    return 0;
}

int minnum(int x,int y){
    if(x <= y){
        return x;
    }
    else{
        return y;
    }
}

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

using namespace std;

#define REP(i,n) for (int i=0;i<(n);++i)

int main() {
	int a, b, c, d, p;
	int x, y;
	cin >> a >> b >> c >> d >> p;

	x = a * p;
	
	y = b;
	if (p > c) y += (p - c) * d;

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

C++: #include <cstdio>

using namespace std;

int main()
{
	long a,b,c,d,p;
	long sum_a = 0, sum_b = 0;
	long value;
	
	scanf("%d %d %d %d %d", &a, &b, &c, &d, &p);
	
	sum_a = a * p;
	sum_b = b;
	
	if(p > c){
		sum_b += d * (p-c);
	}
	
	if(sum_a < sum_b){
		value = sum_a;
	}
	else{
		value = sum_b;
	}
	
	printf("%d\n", value);
}

C++: #include<iostream>

using namespace std;

int main(){
  int a, b ,c, d, e;
  int Atotal = 0, Btotal = 0;
  cin >> a >> b >> c >> d >> e;
  Atotal = a * e;
  Btotal = b;
  if(e > c) Btotal += d * (e - c);
  if(Atotal > Btotal) cout << Btotal << endl;
  else cout << Atotal << endl;
  return 0;
}

C++: a;main(b,c,d,e){scanf("%d%d%d%d%d", &a,&b,&c,&d,&e);a=!printf("%d\n",a*e<b+(e>c?e:c)*d?a*e:b+(e>c?e:c)*d);}

C++: #include <iostream>
#include <string>
#include <algorithm>
using namespace std;
typedef long long ll;

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

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

	int p;
	cin >> p;
	int x = a * p;
	int y = b;
	if(p > c){
		y += (p - c) * d;
	}

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

	return 0;
}

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

C++: #include <iostream>
#include <algorithm>
#include <array>
#include <functional>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string>
#include <vector>

#define INF 1000000000
#define MOD 1000000007
#define ll long long
#define rep(i,a,b) for(int i = (a); i < (b); i++)
#define bitget(a,b) (((a) >> (b)) & 1)
#define vint vector<int>
#define vvint vector<vector<int>>
#define vsort(x) sort(x.begin(),x.end())

using int64 = uint64_t;

using namespace std;

int main() {
	int a[5];
	rep(i, 0, 5)
		cin >> a[i];
	int x, y;
	x = a[4] * a[0];
	y = a[1] + max(0, a[4] - a[2])*a[3];
	cout << min(x, y) << endl;
	return 0;
}

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

#define INF 1.1e9
#define LINF 1.1e18
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) for (int i = (n) - 1; i >= 0; i--)
#define ALL(v) (v).begin(), (v).end()
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define BIT(x, n) bitset<n>(x)
#define PI 3.14159265358979323846

typedef long long ll;
typedef pair< int, int > P;
typedef pair< int, P > PP;

//-------------------------------------------------


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

	int a, b, c, d, p;
	cin >> a >> b >> c >> d >> p;
	cout << min(a * p, (p <= c ? b : b + (p - c) * d)) << endl;


    return 0;
}

C++: #include <stdio.h>
int main () {
	int X_ryokin,Y_kihon,Y_jogen,Y_tuika,siyo;
	int min,X_sum,Y_sum,tuika = 0;
	scanf("%d",&X_ryokin);
	scanf("%d",&Y_kihon);
	scanf("%d",&Y_jogen);
	scanf("%d",&Y_tuika);
	scanf("%d",&siyo);

	X_sum = X_ryokin * siyo;

	if (siyo <= Y_jogen) {
		Y_sum = Y_kihon;
	} else {
		for(siyo; siyo > Y_jogen; siyo--) {
			tuika = tuika + Y_tuika;
		}
		Y_sum = Y_kihon + tuika;
	}
	if (X_sum > Y_sum) {
		min = Y_sum;
	} else {
		min = X_sum;
	} 
	printf("%d\n",min);
}

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

int main() {
	int A, B, C, D, P, X, Y;
	cin >> A >> B >> C >> D >> P;
	X = A*P;
	if(C<P)	Y = B+D*(P-C);
	else Y = B;
	if(X<Y) cout << X << endl;
	else cout << Y << endl;
	return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b,c,d,p,x,y;
  cin>>a>>b>>c>>d>>p;
  x=a*p;
  y=b;
  if(p>c)y+=(p-c)*d;
  cout<<min(x,y)<<endl;
}

C++: //X?????¨Y?????????????????¶?????¨?????§??????????????????????????????????????????
#include <iostream>
#include <algorithm>
using namespace std;

int main()
{
	int a, b, c, d, p;
	cin >> a >> b >> c >> d >> p;
	cout << min(p * a, b + max(p - c, 0) * d) << endl;
	return 0;
}

C++: #include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
template<class T>
using Table = vector<vector<T>>;
const ld eps=1e-9;

//// < "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\a.txt"
int main() {
	int A, B, C, D, P; cin >> A >> B >> C >> D >> P;
	int ans = A*P;
	int nans;
	if (C > P)nans = B;
	else nans = B + (P - C)*D;
	cout << min(ans, nans) << endl;
	return 0;
}

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

using namespace std;

int main() {

	int  A, B, C, D, P;

	cin >> A >> B >> C >> D >> P;

	int Acy = A * P;
	int Bcy;

	if (C >= P)
		Bcy = B;

	else
		Bcy = B + (P - C) * D;

	cout << min(Acy, Bcy) << "\n";

	

	return 0;

}

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

int main() {
	int a, b, c, d, p; cin >> a >> b >> c >> d >> p;
	cout << min(p*a, b + max(p - c, 0)*d) << endl;
	return 0;
}

C++: #include <iostream>
#include <fstream>
#include <typeinfo>
#include <vector>
#include <stack>
#include <cmath>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <iomanip>
#include <cctype>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<25;
const ll INF=1ll<<50;
const double pi=acos(-1);
const double eps=1e-8;
const int mod=1e9+7;
const vi emp;
const int dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};

int a,b,c,d,p;

int main(){
	cin>>a>>b>>c>>d>>p;
	cout<<min(a*p,b+((c<p)?d*(p-c):0))<<endl;
}