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>
using namespace std;
int main(void){
    int a,b,c,d,p;
    cin>>a>>b>>c>>d>>p;
    int my=b+(p-c)*d,m=a*p;
    if(p<=c){
        my=b;
    }
    if(my<m){
        m=my;
    }
    cout<<m<<endl;
}

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

using namespace std;

int A = 0, B = 0;
int C = 0, D = 0;
int P = 0;

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

    int x = A * P;
    int y = (P <= C) ? B : B + D*(P-C);

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

C++: #include <iostream>
#include <string>
#include <map>
#include <math.h>
#include <complex>

using namespace std;

int main(){

    int A,B,C,D,P,answer;

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

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

    cout<<answer<<endl;

    return 0;


}

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

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

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

C++: #include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <algorithm>
#include <sstream>
#include <map>
#include <set>

#define REP(i,k,n) for(int i=k;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1<<30
#define pb push_back
#define mp make_pair

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

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

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

	return 0;
}

C++: #include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <set>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cstring>
#include <iterator>
#include <bitset>
#include <unordered_set>
#include <unordered_map>
#include <fstream>
#include <iomanip>
#include <cassert>
//#include <utility>
//#include <memory>
//#include <functional>
//#include <deque>
//#include <cctype>
//#include <ctime>
//#include <numeric>
//#include <list>
//#include <iomanip>

//#if __cplusplus >= 201103L
//#include <array>
//#include <tuple>
//#include <initializer_list>
//#include <forward_list>
//
//#define cauto const auto&
//#else

//#endif

using namespace std;


typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
    v.assign(a, vector<T>(b, t));
}

template <class F, class T>
void convert(const F &f, T &t){
    stringstream ss;
    ss << f;
    ss >> t;
}

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define reep(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) reep((i),0,(n))
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define F first
#define S second
#define mkp make_pair
#define RALL(v) (v).rbegin(),(v).rend()
#define DEBUG
#ifdef DEBUG
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#else
#define dump(x) 
#define debug(x) 
#endif

#define MOD 1000000007LL
#define EPS 1e-8
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
#define maxs(x,y) x=max(x,y)
#define mins(x,y) x=min(x,y)

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


signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(20);
    mainmain();
}

C++: #include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b) - 1;i>=(a);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)

#define PB push_back
#define INF (1<<29)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define CLR(a) memset(a,0,sizeof(a))
const int dx[] = {-1,0,0,1},dy[] = {0,1,-1,0};

typedef long long int ll;

using namespace std;

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

C++: #include<stdio.h>
int main(void)
{
	int a,b,c,d,p,x,y,n;
	scanf("%d %d %d %d %d",&a,&b,&c,&d,&p);
	x=p*a;
	if(p>c){
		n=p-c;
		y=b+n*d;
		
	}
	else if(p<=c){
		y=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,S=0,T=0;
	cin >> A >> B >> C >> D>> P;
	if (P<=C and 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<stdio.h>
int main(void)
{
	int a,b,c,d,p,s,ss;
	scanf("%d",&a);
	scanf("%d",&b);
	scanf("%d",&c);
	scanf("%d",&d);
	scanf("%d",&p);
	s=a*p;
	if(c<p){
		ss=b+(p-c)*d;
	}
	else{
		ss=b*p;
	}
	if(s<ss){
		printf("%d\n",s);
	}
	else{
		printf("%d\n",ss);
	}
	return 0;
}

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

int main(){
	int A,B,C,D,P,X,Y;
	cin>>A>>B>>C>>D>>P;
	X=A*P;
	Y=max(B,B+D*(P-C));
	cout<<min(X,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;
  }

}

C++: #include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"

using namespace std;

const long long int MOD = 1000000007;


long long int N, M, K, H, W, L, R;


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

	int a, b, c, d, e;
	cin >> a >> b >> c >> d >> e;
	int f = a * e;
	int g = b + max(0, e - c)*d;
	cout << min(f, g)<<endl;
	return 0;
}

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

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

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

int a, b, c, d, e;

int main(){
	cin >> a >> b >> c >> d >> e;
	int f = a*e;
	int s = c > e ? b : b + (e - c)*d;
	cout << (f > s ? s : f) << endl;

	return 0;
}