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))
}

Python: A, B, C, D, P= int(input()),int(input()),int(input()),int(input()),int(input())
print(min(A*P, B if P<=C else B+(P-C)*D))

Python: a = int(input())
b = int(input())
c = int(input())
d = int(input())
p = int(input())
x = p*a
if p>=c:
    y = b+(p-c)*d
else:
    y = b
if x >= y:
    print(y)
else:
    print(x)

Python: A=int(input())
B=int(input())
C=int(input())
D=int(input())
P=int(input())

X=A*P

if P<=C:
    Y=B
else:
    Y=B+(P-C)*D

if X<=Y:
    print(X)
else:
    print(Y)

C++: #include <bits/stdc++.h>

using namespace std;

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
#define unless(p) if(!(p))
#define until(p) while(!(p))

using ll = long long;
// using P = std::tuple<int,int>;

const int dx[8] = {-1, 1, 0, 0, -1, -1, 1, 1}, dy[8] = {0, 0, -1, 1, -1, 1, -1, 1};

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

    int A, B, C, D, P;
    std::cin >> A >> B >> C >> D >> P;

    int res = min(A * P, B + max(P - C, 0) * D);
    std::cout << res << std::endl;
}

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

int main() {
  int a, b, c, d, p;
  int A, B;

  cin >> a >> b >> c >> d >> p;
  A = a*p; 
  B = b;
  if( p > c ) B += (p-c) * d;
  
  cout << min(A, B) << endl;
}

C++: #include<iostream>
using namespace std;
int main(){
    int a,b,c,d,p;
    int x,y;
    cin>>a>>b>>c>>d>>p;
    
    x=a*p;
    if(p>c){
        y=b*p+d*(p-c);
    }else{
        y=b*p;
    }
    if(x>y){
        cout<<y<<endl;
    }else{
        cout<<x<<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;
	cout << min(a*p, b+max(p-c, 0)*d) << endl;
	return 0;
}

C++: #include<stdio.h>
int main(void)
{
	int a,b,c,d,p,x,y,m,n;
	scanf("%d %d %d %d %d",&a,&b,&c,&d,&p);
	x=a*p;
	m=p-c;
	n=d*m;
	if(p<=c){
		y=b;
	}
	else if(c<=p){
		y=b+n;
	}
	if(x<=y){
		printf("%d\n",x);
	}
	else if(y<=x){
		printf("%d\n",y);
	}
	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 Y=b;
	if(p>c)
		Y+=(p-c)*d;


	cout << min(a*p,Y) << endl;
}

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

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

	// your code goes here
	return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <string>
#include <algorithm>

using namespace std;

int main (int argc, char *argv[]) {
    int a, b, c, d, p;
    cin>>a;
    cin>>b;
    cin>>c;
    cin>>d;
    cin>>p;
    int t1 = p * a;
    int t2 = b + max((p - c), 0) * d;
    cout<<min(t1, t2)<<endl;
    return 0;
}

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

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

	int x = p * a;
	int y = (p < c) ? b : (b + d * (p-c));

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

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

int main(){

  int a, b, c, d, p, ans;

  cin >> a >> b >> c >> d >> p;

  if(p > c) ans = min(a*p, (p-c)*d+b);
  else ans = min(a*p, b);
  
  cout << ans << endl;

}

C++: 

#include <iostream>
using namespace std;

int main() {
	int a,b,c,d,p,xsya = 0,ysya = 0;
	cin >> a;
	cin >> b;
	cin >> c;
	cin >> d;
	cin >> p;
	xsya = a * p;
	if(p > c){
	ysya = b + (p - c) * d;
	}
	else{
		ysya = b;
	}
	if(xsya > ysya){
		cout << ysya << endl;
	}
	else{
		cout << xsya << endl;
	}


	return 0;
}

C++: #include<stdio.h>
int main(void)
{
	int XA,YB,YC,YD,P,X,Y;
	scanf("%d",&XA);
	scanf("%d",&YB);
	scanf("%d",&YC);
	scanf("%d",&YD);
	scanf("%d",&P);
	X=XA*P;
	if(YC<P){
		Y=P-YC;
		Y=Y*YD;
	}
	Y=Y+YB;
	if(X>Y){
		printf("%d\n",Y);
	}
	else{
		printf("%d\n",X);
	}
	return 0;
}

C++: #include <iostream>
using namespace std;
int main(){
    int x[5],num,num2;
    for(int i=0; i<5; i++){
        cin >> x[i];
    }
    num=x[4]*x[0];
    if(x[4]>x[2]){
        num2=x[1]+(x[4]-x[2])*x[3];
    }
    else{
        num2=x[1];
    }

    if(num>num2){
        cout << num2 << endl;
    }
    else{
        cout << num << endl;
    }
    return 0;
}

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

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

  scanf("%d %d %d %d %d",&a,&b,&c,&d,&p);

  x=a*p;

  if(p<=c) y=b;
  else{
    y=b;
    y+=d*(p-c);
  }

  if(x>y) x=y;

  printf("%d\n",x);

  return 0;
}

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

int main(){
int a,b,c,d,e;
scanf("%d%d%d%d%d",&a,&b,&c,&d,&e);
int s=a*e;
int p=b;
if(c<e)p+=d*(e-c);
printf("%d\n",min(p,s));
}

C++: #include <iostream>

using namespace std;

int main(){

	int a , b , c , d;
	int p;

	cin >> a >> b >> c >> d >> p;

	int A = a * p;
	if(c > p){
		if(b < A) cout << b << endl;
		else cout << A << endl;
	}
	else if(c < p){
		int l = p - c;
		int ans = b + (d * l);
		cout << ans << endl;
	}

	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
#define FOR(i, s, n) for(int i = s; i < (int)n; ++i)
#define per(i, n) for(int i = n; i >= 0; i--)
#define ROF(i, s, n) for(int i = s; i >= (int)n; i--)
#define FORIT(i, A) for (auto i : A)
#define PRINT(x) cout << (x) << "\n"
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define MP make_pair
#define PB push_back
#define EACH(i, n) for (__typeof((n).begin()) i = (n).begin(); i != (n).end(); ++i)
#define SZ(a) int((a).size())
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define CLR(a) memset((a), 0 ,sizeof(a))
#define NCLR(a) memset((a), -1 ,sizeof(a))
#define sq(n) (n) * (n)
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef priority_queue<int> maxpq;
typedef priority_queue< int, vector<int>, greater<int> > minpq;
typedef complex<double> Point;
static const double EPS = 1e-10;
static const double PI = acos( -1.0 );
static const int mod = 1000000007;
static const int INF = 1 << 29;
static const LL LL_INF = 1ll << 60;
static const int dx[] = { -1, 0, 1, 0, 1, -1, 1, -1 };
static const int dy[] = { 0, -1, 0, 1, 1, 1, -1, -1 };

#ifdef WIN32
#define dump(x) cerr << #x << " = " << (x) << "\n"
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << "\n"
#else
#define dump(x)
#define debug(x)
#endif

int a, b, c, d, p;

void input() {
  scanf( "%d %d %d %d %d", &a, &b, &c, &d, &p );
}

void solve() {
  printf( "%d\n", min( a * p, b + max( 0, p - c ) * d ) );
}

int main() {
  input();
#ifdef WIN32
  clock_t stime = clock();
#endif
  solve();
#ifdef WIN32
  clock_t etime = clock();
  fprintf(stderr,"TIME : %f\n", ( double ) ( etime - stime ) / CLOCKS_PER_SEC);
#endif
  return 0;
}