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 <bits/stdc++.h> // {{{

#define ARG4(_1, _2, _3, _4, ...) _4
#define rep(...) ARG4(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define REP(i, a) FOR(i, 0, a)
#define FOR(i, a, b) for (int i = (a); i < (int)(b); ++i)
#define rrep(...) ARG4(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
#define RREP(i, a) RFOR(i, 0, a)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (int)(a); --i)
#define ALL(c) (c).begin(), (c).end()
#define TEN(n) ((ll)(1e##n))
#define pb emplace_back
#define mp make_pair
#define fi first
#define se second
#define let const auto
#define USE_T template <typename T>
#define USE_Ti template <typename T = int>
#define USE_TU template <typename T, typename U>

USE_Ti using duo = std::pair<T, T>;
USE_Ti using vec = std::vector<T>;
using ll = long long;
// clang-format off
USE_TU inline bool chmax(T&x,U a){return x<a&&(x=a,1);}
USE_TU inline bool chmin(T&x,U a){return a<x&&(x=a,1);}
USE_Ti inline T in(){T x;std::cin>>x;return x;}
USE_Ti inline vec<T> in(int n){vec<T> v;v.reserve(n);rep(i,n)v.pb(in<T>());return v;}
USE_T inline void in(T*x,int n){rep(i,n)x[i]=in<T>();}
struct IoSetup {
  IoSetup(){
    using namespace std;
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout<<setprecision(10);
    cerr<<setprecision(10);
  }
} iosetup;
// clang-format on
// }}}
using namespace std;
const int inf = 1001001001;
const ll infll = 1001001001001001001ll;
const int dd[] = {0, 1, 0, -1, 0};

signed main() {
  int A = in(), B = in(), C = in(), D = in(), P = in();
  cout << min(A * P, B + max(P - C, 0) * D) << endl;
  return 0;
}

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

int main(){
  int A, B, C, D, P;
  cin >> A >> B >> C >> D >> P;
  int X = A * P;
  int Y = B + D * max(0, C - B);

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

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

int main(int argc, char *argv[])
{
  int A, B, C, D, P;
  int Xcost, Ycost;

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

  Xcost = A*P;

  if (C >= P) {
    Ycost = B;
  }
  else {
    int sub = P - C;
    int extra = sub*D;
    Ycost = B + extra;
  }

  cout << min(Xcost, Ycost) << endl;
  
  return 0;
}

C++: // 2015/07/03 Tazoe

#include <iostream>
using namespace std;

int main()
{
	int A;
	cin >> A;

	int B;
	cin >> B;

	int C;
	cin >> C;

	int D;
	cin >> D;

	int P;
	cin >> P;

	int X = A*P;

	int Y = B;
	if(P>C){
		Y += D*(P-C);
	}

	if(X<=Y){
		cout << X << endl;
	}
	else{
		cout << Y << endl;
	}

	return 0;
}

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(p<=c){
    y=b;
  }else{
    y=b+(p-c)*d;
      }
  if(x<y){
    cout<<x<<endl;
  }else{
    cout<<y<<endl;
  }
  return 0;
}

C++: #include <stdio.h>

int main(void) {
	
	int xa, yb, yc, yd, jp;
	int xlim, ylim, jlim;
	
	scanf("%d", &xa);
	scanf("%d", &yb);
	scanf("%d", &yc);
	scanf("%d", &yd);
	scanf("%d", &jp);
	
	xlim = xa * jp;
	
	if (jp <= yc) {
		ylim = yb;
	} else {
		ylim = (jp - yc) * yd + yb;
	}
	
	jlim = (xlim < ylim)? xlim : ylim;
	
	printf("%d\n", jlim);
	
	return 0;
}

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

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

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

  if(p>c){
    b += d*(p-c);
  }

  a = a*p < b ? a*p : b;

  cout << a << endl;

  return 0;

}

C++: //============================================================================
// Name        : JOI.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
using namespace std;
int A,B,C,D,P;
int main() {
	cin>>A>>B>>C>>D>>P;

	int S,T;
	S=P*A;
	if(C<P)T=B+(P-C)*D;
	if(C>P || C==P)T=B;

	if(S>T)cout<<T<<endl;
	if(S<T)cout<<S<<endl;
	if(S==T)cout<<S<<endl;
	return 0;
}

C++: #include <iostream>
using namespace std;
int main(void){
    int a,b,c,d,p;
    cin>>a>>b>>c>>d>>p;
    int x;
    int y;
    x=a*p;//x社の料金
    if(p<=c)    y=b;
    else    y=b+(p-c)*d;
    if(x<y) cout<<x;
    else    cout<<y;
    cout<<endl;
    
}

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

int main() {
	
	/*
	int a, b, c, d, e;
	cin >> a >> b >> c >> d >> e;

	int answer;
	if (a < 0) {
		answer = -a * c + d + b * e;
	}
	if (a > 0) {
		answer = (b - a)*e;
	}

	cout << answer << endl;
	*/

	/*
	int a, b, c, d, e;
	cin >> a >> b >> c >> d >> e;
	int answer;
	if (a < 40) {
		a = 40;
	}
	if (b < 40) {
		b = 40;
	}
	if (c < 40) {
		c = 40;
	}
	if (d < 40) {
		d = 40;
	}
	if (e < 40) {
		e = 40;
	}
	answer = (a + b + c + d + e) / 5;
	cout << answer << endl;
	*/

	/*
	int a, b, c, d, e, f, answer;
	cin >> a >> b >> c >> d >> e >> f;
	if (a <= b&&a <= c&&a <= d) {
		answer = b + c + d;
	}
	if (b <= a&&b <= c&&b <= d) {
		answer = a + c + d;
	}
	if (c <= a && c <= b && c <= d) {
		answer = a + b + d;
	}
	if (d <= a && d <= b && d <= c) {
		answer = a + b + c;
	}
	if (e <= f) {
		answer = answer + f;
	}
	if (e > f) {
		answer = answer + e;
	}
	cout<<answer<< endl;
	*/

	/*
	int a, b, c, d, e, f;
	cin >> a >> b >> c >> d >> e >> f;
	cout << a + b + c + d + e + f - min({ a,b,c,d }) - min({ e,f }) << endl;
	*/

	int a, b, c, d, p;
	cin >> a >> b >> c >> d >> p;
	cout << min(a*p, b + max(0, (p - c)*d)) << 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;
}

C++: #include <stdio.h>

int main(void){
    int a,b,c,d,p;
    int costx, costy;
    
    scanf("%d%d%d%d%d", &a, &b, &c, &d, &p);
    costx = a*p;
    costy = b + (p>c?(p-c)*d:0);
    
    printf("%d", costx>costy?costy:costx);
      
    return 0;
}

C++: #include <cstdio>

int a,b,c,d,p;

int min(int x,int y){
	if(x>y)return y;
	return x;
}

int main(void){
	scanf("%d",&a);
	scanf("%d",&b);
	scanf("%d",&c);
	scanf("%d",&d);
	scanf("%d",&p);
	int na=a*p;
	int nb=b;
	if(p>c){
		nb+=d*(p-c);
	}
	printf("%d\n",min(na,nb));
	return 0;
}

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

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

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

		if(P<=C){
			if(P*A<B){
				cout<<P*A<<endl;
			}else{ 
				cout<<B<<endl;
			}
		}else{
			if(P*A<B+D*(P-C)){
				cout<<P*A<<endl;
			}else{
				cout<<B+D*(P-C)<<endl;
			}
		}

return 0;
}

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

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

C++: #include <iostream>
using namespace std;
int main(){
      int a,b,c,d,e;
      cin>>a>>b>>c>>d>>e;
      cout<<min(a*e,b+(e>c?e-c:0)*d)<<endl;
}

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

int main() {
    int a, b, c, d, p, bc;
    std::scanf("%d %d %d %d %d", &a, &b, &c, &d, &p);
    bc = (p > c) ? b + (p-c) * d : b;
    (a * p < bc) ? printf("%d\n", a * p) : printf("%d\n", bc);
    return 0;
}