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>
using namespace std;
int main(){
int A,B,C,D,P,X,Y;
cin>>A>>B>>C>>D>>P>>X>>Y;
    X=A*P;
    if(P<=C)
        Y=B;
    else
        Y=B+(P-C)*D;
      
    if(X>Y)
        cout<<Y<<endl;
    else
        cout<<X<<endl;
    
return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <set>

using namespace std;

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

C++: // clang-format off

#include <bits/stdc++.h>

#define int long long

#define main signed main()

// #define main int main()

#define loop(i, a, n) for (int i = (a); i < (n); i++)

#define rep(i, n) loop(i, 0, n)

#define all(v) (v).begin(), (v).end()

#define rall(v) (v).rbegin(), (v).rend()

#define prec(n) fixed << setprecision(n)

#define stlice(from, to) substr(from, (to) - (from) + 1)

#define pb push_back

#define mp make_pair

#define mt make_tuple

#define fi first

#define se second

using namespace std;

typedef pair<int, int> pii;

typedef vector<int> vi;

typedef vector<double> vd;

typedef vector<char> vc;

typedef vector<bool> vb;

typedef vector<string> vs;

typedef vector<pii> vpii;

typedef vector<vi> vvi;

typedef vector<vb> vvb;

typedef vector<vpii> vvpii;

const int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;

const int MOD = 1000000007;

const double PI = acos(-1);

template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }

template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }

bool odd(const int &n) { return n & 1; }

bool even(const int &n) { return !odd(n); }

void solve();

main { solve(); return 0; }

// clang-format on



void solve() {

  int a, b, c, d, p;

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

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

}

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

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

C++: #include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <map>
#include <queue>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using namespace std;

template<class T>
constexpr T INF = ::numeric_limits<T>::max() / 32 * 15 + 208;

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

C++: # include <iostream>
# include <vector>
# include <limits>
# include <algorithm>
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 << y << endl;
	}
	else {
		cout << x << endl;
	}
}

C++: #include<iostream>
#include<algorithm>
using namespace std;
int main() {
	int a, b, c, d, p,ans[5];
	cin >> a >> b >> c >> d >> p;
	ans[1] = a * p;
	ans[2] = b;
	if (p > c) {
		p = p - c;
		ans[2] = ans[2] + p * d;
	}
	cout << min(ans[1], ans[2]) << endl;
}

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 + d*max(0,p-c)) << endl;
}

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

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

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

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

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

using namespace std;
using ull = unsigned long long;
using ll = long long;
using lli = long long int;
using ld = long double;
using pa = pair<int,int>;
using ppa = pair<pa,int>;
#define SORT(v, n) sort(v, v+n);
#define ALL(v) v.begin(),v.end()
#define VSORT(v) sort(ALL(v))
#define GRESORT(v) sort(ALL(v),greater<ll>())
#define REVERSE(v) reverse(ALL(v))
#define overlap(v) v.erase(unique(ALL(v)),v.end())
#define debug(x) cout << #x << ": " << x << endl
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,n) FOR(i,0,n)
#define RFOR(i,a,b) for(int i = (b-1); i >= a; i--)
#define rrep(i,n) RFOR(i,0,n)
#define INF INT_MAX
#define SUP INT_MIN
#define mins(a,b) a = min(a,b)
#define maxs(a,b) a = max(a,b)

//4??????
int dy[]={0, 1, 0, -1};
int dx[]={1, 0, -1, 0};

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

const ll MOD = 1000000007;

ll pow_mod(ll a,ll b,ll mod){
    ll tmp = 1;
    a %= mod;
    if(b > 0){
        tmp = pow_mod(a, b/2, mod);
        if(b % 2) tmp = (((tmp*tmp)%mod)*a)%mod;
        else tmp = (tmp*tmp)%mod;
    }
    return tmp;
}


void solve() {
    ll a,b,c,d,p; cin >> a >> b >> c >> d >> p;
    ll sum1 = a * p, sum2 = 0;
    if(c > p) sum2 = b;
    else sum2 = b + (p-c) * d;
    cout << min(sum1,sum2) << endl;
}

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

    solve();

    return 0;
}

C++: #include <stdio.h>

int main(void) {
  int X_A = 0;
  int Y_B = 0;
  int C = 0;
  int Y_D = 0;
  int P = 0;

  int costX = 0;
  int costY = 0;

  scanf("%d", &X_A);
  scanf("%d", &Y_B);
  scanf("%d", &C);
  scanf("%d", &Y_D);
  scanf("%d", &P);

  costX = X_A * P;
  costY = Y_B;  
    
  if (P > C) {
    costY += (P - C) * Y_D;
  }

  if (costX < costY) {
    printf("%d\n", costX);
  } else {
    printf("%d\n", costY);
  }
  
  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 + (p > c ? (p - c) * d : 0)) << endl;
}

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

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

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

	if (p <= c){
		printf("%d\n", max(p * a, b));
	}
	else {
		printf("%d\n", max(p * a, b + (c - p) * d));
	}

	return (0);
}

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

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