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++: // 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;
using pii = pair<int, int>;
using vi = vector<int>;
using vd = vector<double>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vpii = vector<pii>;
using vvi = vector<vi>;
using vvb = vector<vb>;
using vvpii = vector<vpii>;
template<typename A> using fn = function<A>;
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr 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; }
constexpr bool odd(const int &n) { return n & 1; }
constexpr 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<cstdio>
#include<algorithm>
using namespace std;
int main(void)
{
	int a,b,c,d,p,x,y,mn;
	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;
	}
	mn=min(x,y);
	printf("%d\n",mn);
	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<<x;
	cout<<endl;
}

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

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

  int ratex = a * p;
  int ratey = b;
  if (p >= c) ratey += d * (p - c);
  int rate = min(ratex, ratey);

  cout << rate << 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;
  cout << min(A * P, max(B, D * (P - C) + B)) << endl;
  return 0;
}

C++: #include<iostream>
using namespace std;
int main(void)
{
	int x,y,a,b,c,d,p;
	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;
	return 0;
}

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

int main() {
	int A, B, C, D, P;
	int Xnum=0, Ynum=0;

	cin >> A >> B >> C >> D >> P;
	Xnum = A * P;
	if (P <= C) {
		Ynum = B;
	}
	if (P > C) {
		Ynum = B + D * (P - C);
	}

	if (Xnum >= Ynum) {
		cout << Ynum <<endl;
	}
	else if (Xnum < Ynum) {
		cout << Xnum << endl;
	}
	
	return 0;
}

C++: #include <cstdio>
#include <queue>
#include <algorithm>

#define rep(i, n) for(int i = 0; i < (n); ++i)

using namespace std;

int a, b, c, d, p;

int main(){
	scanf("%d%d%d%d%d", &a, &b, &c, &d, &p);
	int x = p * a;
	int y = b + max(p - c, 0) * d;
	printf("%d\n", min(x, y));
	return 0;
}

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

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

  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)
    cout<<X<<endl;
  else
    cout<<Y<<endl;
}

C++: #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 + (P - C)*D;
	if (P <= C) {
	 if (X < B) {
		cout << X << endl;
	}
	else{
		cout << B << endl;
	}
}
	if (P > C) {
	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,X,Y;
	cin>>A>>B>>C>>D>>P;
	X=A*P;
	Y=B+D*(P-C);
	cout<<min(X,Y)<<endl;
	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
// #define int long long
typedef long long ll;
typedef pair<int,int> pii;
#define ITR(v,c) for(auto v=begin(c);v!=end(c);v++)
#define FOR(v,a,n) for(int v=a;v<(int)(n);v++)
#define FORE(x,arr) for(auto &x:arr)
#define REP(v,n) FOR(v,0,n)
#define RREP(v,n) for(int v=(int)(n);v>=0;v--)
#define ALL(c) begin(c),end(c)
const int DX[4]={0,1,0,-1}, DY[4]={-1,0,1,0};
const int INF = 1e9;
const ll INFLL = 1e18;
template<class T,class U>ostream&operator<<(ostream &os,const pair<T,U> &p){
    os<<"("<<p.first<<","<<p.second<<")";return os;}
template<class T>ostream&operator<<(ostream &os,const vector<T> &v){
    ITR(i,v)os<<*i<<(i==end(v)-1?"":" ");return os;}
//------------------------------------------------------------------------------

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

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", min(p * a, b));
	}
	else {
		printf("%d\n", min(p * a, b + (c - p) * d));
	}

	return (0);
}

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

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

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

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

    return 0;
}