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<iostream>
#include<sstream>
#include<algorithm>
#include<climits>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<ctime>
#include<cfloat>
#include<functional>
#include<map>
#include<string>
#include<cstring>
#include<vector>
#include<queue>
#include<stack>
#include<deque>
#include<set>
#include<bitset>
#include<list>
#include<numeric>
#include<complex>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<long long, int> ll_i;
typedef pair<double, int> d_i;
typedef pair<long long, long long> ll_ll;
typedef pair<double, double> d_d;

#define PI 3.141592653589793238462643383279
#define mod 1000000007LL
#define rep(i, n) for(i = 0;i < n;++i)
#define rep1(i, n) for(i = 1;i < n;++i)
#define rep2d(i, j, n) for(i = 0;i < n;++i)for(j = i + 1;j < n;++j)
#define per(i, n) for(i = n - 1;i > -1;--i)
#define int(x) int x; scanf("%d",&x)
#define int2(x, y) int x, y; scanf("%d%d",&x, &y)
#define int3(x, y, z) int x, y, z; scanf("%d%d%d",&x, &y, &z)
#define sc(x) cin >> x
#define sc2(x, y) cin >> x >> y
#define sc3(x, y, z) cin >> x >> y >> z
#define scn(n, a) rep(i, n)cin >> a[i]
#define sc2n(n, a, b) rep(i, n)cin >> a[i] >> b[i]
#define pri(x) cout << x << "\n"
#define pri2(x, y) cout << x << " " << y << "\n"
#define pri3(x, y, z) cout << x << " " << y << " " << z << "\n"
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define kabe puts("---------------------------")
#define kara puts("")
#define debug(x) cout << " --- " << x << "\n"
#define debug2(x, y) cout << " --- " << x << " " << y << "\n"
#define debug3(x, y, z) cout << " --- " << x << " " << y << " " << z << "\n"
#define debugn(i, n, a) rep(i, n)cout << " --- " << a[i] << "\n";
#define debugin(i, n, a) rep(i, n)printf(" --- %10d\n", a[i])
#define debugi2n(i, n, a, b) rep(i, n)printf(" --- %10d %10d\n", a[i], b[i])
#define debugiin(i, n, a) rep(i, n)printf(" --- %10d %10d\n", a[i].first, a[i].second)
#define X first
#define Y second
#define eps 0.0001
#define prid(x) printf("%.15lf\n", x)


signed main(void){
  int i, j;
  for(int testcase = 0;;testcase++){
    int3(a, b, c);
    int2(d, p);

    int res = a * p;
    if(p <= c)res = min(res, b);
    else res = min(res, (p - c) * d + b);

    pri(res);

/*/

//*/ break;
  }
  return 0;
}

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

using namespace std;

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

#define MOD 1000000007
#define REP(i, N) for (int i = 0; i < N; ++i)
#define REP1(i, N) for (int i = 1; i <= N; ++i)
#define RREP(i, N) for (int i = N - 1; i >= 0; --i)
#define ALL(a) a.begin(), a.end()

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

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

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

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

	int a[5];
	for (int i = 0;i < 5;i++){
		cin >> a[i];
	}	

	int x =  a[0]*a[4];
	int y = 0;
	if(a[4] > a[2]) y = a[1]+(a[4]-a[2])*a[3];
	else y = a[1];

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

	return 0;

}

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

C++: #include<stdio.h>
int main(void)
{
	int A,B,C,D,P,y,x,w;
	w=0;
	scanf("%d %d %d %d %d",&A,&B,&C,&D,&P);
	x=P*A;
	if(P<=C){
		y=B;
	}
	else{
		w=P-C;
		y=w*D+B;
	}
	
	if(x<y){
		printf("%d\n",x);
	}
	else{
		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 X,Y;
	X = a * p;
	if (p <= c) {
		Y = b;
	}
	else {
		Y = b + d*(p-c);
	}
	cout << std::min(X, Y) << std::endl;
}

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

int main()
{
  int a,b,c,d,p,cost;
  cin >> a >> b >> c >> d >> p;
  if(p<=c) cost=b;
  else cost=b+(p-c)*d;
  cout << min(cost,a*p) << endl;
  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) {
        cout << min(a * p, b) << '\n';
    } else {
        cout << min(a * p, b + (p - c) * d) << '\n';
    }
}

C++: 
#include <stdio.h>
#include <math.h>
#include <algorithm>

using namespace std;

int main() {

	int A, B, C, D, P;

	scanf("%d", &A);
	scanf("%d", &B);
	scanf("%d", &C);
	scanf("%d", &D);
	scanf("%d", &P);

	printf("%d\n", min(A * P, B + ((C < P) ? D * (P - C) : 0)));

	return 0;
}

C++: #include <bits/stdc++.h>
#define rep(i,l,n) for(int i=l;i<n;i++)
#define rer(i,l,n) for(int i=l;i<=n;i++)
#define all(a) a.begin(),a.end()
#define o(a) cout<<a<<endl
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int,int> pii;

int main(){
	int a,b,c,d,p,x,y;
	cin>>a>>b>>c>>d>>p;
	x=a*p;
	y=(p>c)?b+(p-c)*d:b;
	o(min(x,y));
}

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

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

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

  x = a * p;

  if (c >= p){
    y = b;
  }

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

  if (x > y){
    cout << y <<"\n";
  }
  else {
    cout << x  <<"\n";
  }

  return 0;
}

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

int min(int a, int b) {
	if (a <= b)return a;
	return b;
}

int main() {
	int A, B, C, D, P;
	int sum1, sum2;

	scanf("%d%d%d%d%d", &A, &B, &C, &D, &P);

	sum1 = A*P;
	sum2 = B + ((P > C) ? D*(P - C) : 0);

	printf("%d\n", min(sum1, sum2));

	return 0;
}

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

using namespace std;

int main()
{
	int a, b, c, d, p, X, Y, t;
	cin >> a >> b >> c >> d >> p;
		X = a*p;
		if (c <= p){
			Y = b;
		}
		else{
			t=p - c;
			Y = t*d + b;
		}

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

	return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
int main()
{
  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 <bits/stdc++.h>
using namespace std;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a,b,c,d,p;
    cin >> a >> b >> c >> d >> p;
    int q,w;
    q=p*a;
    if(p<=c){w=b;}
    else w=b+d*(p-c);
    cout << min(q,w) << 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=p*a;
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<iostream>
using namespace std;
int a, b, c, d, p;
int pA, pB;
int main(){
    cin >> a >> b >> c >> d >> p;
pA = a * p;
if (p <= c) {
  pB = b;
}else {
pB = b + (p - c) * d;
}
cout << min(pA, pB) << endl;
return 0;
}

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

int main() {

  int xa,yb,c,d,p;
  cin >> xa >> yb >> c  >> d >> p;

  int x,y;

  x = xa * p;

  y = yb;
  if(c - p < 0) y += (p-c) * d;

  if(x > y) cout << y << endl;
  else cout << x << endl;;

  return 0;

}