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;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using tlll=tuple<ll,ll,ll>;
using vs=vector<string>;

#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define range(i,a,n) for(int i=(a);i<(n);i++)

#define LINF ((ll)1ll<<60)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI 3.1415926535897932384

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

template<class T>bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T>bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class S>S acm(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
void YN(bool b){cout<<(b?"YES":"NO")<<"\n";}
void Yn(bool b){cout<<(b?"Yes":"No")<<"\n";}
void yn(bool b){cout<<(b?"yes":"no")<<"\n";}

ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1; for(auto s:t){os<<(a?"":" ")<<s;a=0;} return os;}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int a,b,c,d,e;
	cin>>a>>b>>c>>d>>e;
	cout<<min(a*e,b+max(e-c,0)*d)<<endl;
}

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(c>p) y=b*p;
	else {
		p=p-c; y=b; y=y+d*p;
	}
	if(x<y) printf("%d\n",x);
	else printf("%d\n",y);
	return 0;
}

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

C++: #include <stdio.h>
#include <stdlib.h>

int main(void)
{
	int xa;
	int yb, yc, yd;
	int p;
	
	
	scanf("%d %d %d %d %d", &xa, &yb, &yc, &yd, &p);
	
	xa = p * xa;
	
	if (yc < p){
		yb += (p - yc) * yd;
	}
	
	printf("%d\n", min(xa, yb));
	
	return (0);
}

C++: #include <iostream>

using namespace std;

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

C++: #include<stdio.h>

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

C++: #include<bits/stdc++.h>
using namespace std;int a,b,c,d,p,x,y;
main(){cin>>a>>b>>c>>d>>p;x=a*p;y=max(b,(p-c)*d+b);cout<<min(x,y)<<endl;}

C++: #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=998244353,MAX=1<<18,INF=1<<30;

int main(){
    
    int A,B,C,D,P;cin>>A>>B>>C>>D>>P;
    cout<<min(A*P,B+(P<=C ? 0 : (P-C)*D))<<endl;
}

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

int main(){
  int A, B, C, D, E;
  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>
using namespace std;
int main(){
	int a,b,c,d,p;
	cin>>a>>b>>c>>d>>p;
	int x=a*p,y=0;
	if(p>c){
		for(int i=p;i>c;i--){
			y+=d;
		}
	}
	y+=b;
	if(x>=y)cout<<y<<endl;
	else cout<<x<<endl;
}

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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    size_t A,B,C,D,P,Cost_X,Cost_Y = 1;
    cin >> A >> B >> C >> D >> P;
    
    Cost_X = A*P;
    
    Cost_Y = B;
    if(P > C){
        P -= C;
        Cost_Y += P*D;
    }
    
    if(Cost_X < Cost_Y){
        cout << Cost_X << "\n";
    }else{
        cout << Cost_Y << "\n";
    }
    
    return 0;
}

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

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

int main() {
	int A,B,C,D,P,S,X,Y;
	cin >> A >> B >> C >> D >> P;
	X=A*P;
	if(P<C){
		Y=B;
	}
	else{
		S=P-C;
		Y=B+D*S;
	}
	if(X<Y){
		cout << X << endl;
	}
	else{
		cout << Y << endl;
	}
	return 0;
}

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

int main()
{
    int A, B, C, D, P;
    int X, Y;

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

    X = A * P;
    if (P < C){
        Y = B;
    }
    else if(C < P){
        Y = ((P - C) * D) + B;
    }
    
    cout << min(X, Y) << 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;
	int x, y;
	x = a*p;
	if (p < c){
		y = b;
	}
	else
	{
		y = b + (p - c)*d;
	}
	cout << min(x, y) << endl;
}

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

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

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

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

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

	if(X>=Y){
	Z = Y;
	}

	else{
	Z = X;
	}

 cout << Z << endl;

return 0;
}

C++: #include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
#include <deque>
#include <iomanip>
#include <limits>
#include <fstream>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
typedef long long ll;

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int a,b,c,d,p;
  cin>>a>>b>>c>>d>>p;
  cout<<min(a*p,b+max(0, p-c)*d)<<endl;
}