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 ;

#define pb(n) push_back(n)
#define fi first
#define se second
#define all(r) (r).begin(),(r).end()
#define gsort(st,en) sort((st),(en),greater<int>())
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
#define vary(type,name,size,init) vector< type> name(size,init)
#define vvl(v,w,h,init) vector<vector<ll>> v(w,vector<ll>(h,init));

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using dict = map<string,int>;
using pii = pair<int,int> ;
using pll = pair<ll,ll> ;

const int mod = 1000000007;
constexpr int imax = ((1<<30)-1)*2+1 ;
constexpr int inf = 100000000;
constexpr double PI = acos(-1.0) ;
double eps = 1e-10 ;
const int dy[] = {-1,0,1,0,1,-1,1,-1};
const int dx[] = {0,-1,0,1,1,-1,-1,1};

inline bool value(int x,int y,int w,int h){
  return (x >= 0 && x < w && y >= 0 && y < h);
}

template<typename T>
void Unique(vector<T> &v){
  sort(all(v));
  v.erase(unique(all(v)),v.end());
}

template<typename T>
T ston(string& str, T n){
  istringstream sin(str) ;
  T num ;
  sin >> num ;
  return num ;
}

void Ans(bool f){
  if(f) cout << "YES"<<endl;
  else cout << "NO"<<endl;
}

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

C++: //
//  main.cpp

#include <iostream>
using namespace std;


int main(){	
	int x,yb,yc,yd,p;
	cin >> x >> yb >> yc >> yd >> p;
	cout << min(p*x,yb + max(p - yc,0)*yd) << endl;
	return 0;
}

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

int main()
{
	//?°´?????????
	int num1=0,num2=0,num3=0,num4=0,num5=0,x=0,y=0;
	cin>>num1>>num2>>num3>>num4>>num5;
	x=num1*num5;
	if(num3>num5){
		y=num2;
		if(x<y){
			cout<<x;
		}
		if(x>y){
			cout<<y;
		}
	}
	if(num3<num5){
		y=num2+num4*(num5-num3);
		if(x<y){
			cout<<x;
		}
		if(x>y){
			cout<<y;
		}
	}
	cout<<"\n";
	return 0;
}

C++: #include <iostream>
#include <stdio.h>
#include <string.h>
#include <functional>
#include <algorithm>
#include <string>
#include <vector>
#include <algorithm>
#include <time.h>
#include <stdlib.h>

using namespace std;

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

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

	x = a * p;

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

	if (x <= y)
	{
		cout << x << endl;
	}
	else
	{
		cout << y << endl;
	}
}

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 (C>P){
	S=A*P;
	cout<< S << endl;
	}
	else{
	T=B+(P-C)*D;
	cout<< T << endl;
	}


	// your code goes here
	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
const int dx[]={1,0,0,-1,1,-1,-1,1};
const int dy[]={0,1,-1,0,1,1,-1,-1};
const int INF = 1e8;
const double EPS = 1e-8;
#define PB push_back
#define mk make_pair
#define fr first
#define sc second
#define reps(i,j,k) for(int i = (j); i < (k); ++i)
#define rep(i,j) reps(i,0,j)
#define MOD 1000000007
#define lengthof(x) (sizeof(x) / sizeof(*(x)))
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> Pii;
typedef pair<int,vi > P;
typedef unsigned long long ll;
int main(){
	int A,B,C,D,P;
	cin >> A >> B >> C >> D >> P;
	int X = P*A;
	int Y = B;
	if(P > C){
		int Z = P-C;
		Y += Z*D;
	}
	cout << min(X,Y) << "\n";		
	return 0;
}

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

using namespace std;

int main(){
	int a,b,c,d,p;
	int sumx,sumy;
	scanf("%d",&a);
	scanf("%d",&b);
	scanf("%d",&c);
	scanf("%d",&d);
	scanf("%d",&p);
	sumx=a*p;
	if(p<=c)
	sumy=b;
	else{
		p-=c;
		sumy=b+(p*d);
	}
	if(sumx>sumy)
	printf("%d\n",sumy);
	else
	printf("%d\n",sumx);
}

C++: // 2016/04/30 Tazoe

#include <iostream>
using namespace std;

int main()
{
	int A, B, C, D, P;
	cin >> A;
	cin >> B;
	cin >> C;
	cin >> D;
	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 <cstdio>
#include <algorithm>
using namespace std;

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

	int x, y;
	x = a * p;
	if (p <= c){
		y = b;
	}else{
		y = b + d * (p - c);
	}

	printf("%d\n", min(x, y));

	return 0;
}

C++: #include<stdio.h>
int main(void)
{
    int a,b,c,d,e,z,x;
	scanf("%d",&a);
	scanf("%d",&b);
	scanf("%d",&c);
	scanf("%d",&d);
	scanf("%d",&e);
	z=e*a;
	x=c+(e*d);
	if(z>x)
	printf("%d\n",z);
	else if(x>z){
	    printf("%d\n",x);
	}
	return 0;
}

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

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

  x = p * a;
  y = b;

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

  if (x > y){
    x = y;
  }

  cout << x << endl;

  return 0;
}

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

typedef long long ll;
typedef unsigned long long ull;
typedef unsigned __int128 HASH;
typedef pair<int,int> pii;
typedef pair<ll,int> plli;
typedef pair<int,pii> pipii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<pii> vpii;

#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n);i>0;i--)
#define rrep2(i,a,b) for (int i=(a);i>b;i--)
#define pb push_back
#define fi first
#define se second
#define all(a) (a).begin(),(a).end()

const ll mod = 1e9 + 7;
const ll hmod1 = 999999937;
const ll hmod2 = 1000000000 + 9;
const ll INF = 1<<30;
const int dx4[4] = {1, 0, -1, 0};
const int dy4[4] = {0, 1, 0, -1};
const int dx8[8] = {1, 1, 1, 0, 0, -1, -1, -1};
const int dy8[8] = {0, 1, -1, 1, -1, 0, 1, -1};
const double pi = 3.141592653589793;
const HASH B = 1e9 + 7;

int a, b, c, d, p;


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

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