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<cstdio>
#include<iostream>
#include<cstring>
using namespace std;
int main(void)
{
	int a,b,c,d,p,y,x,n;
	cin>>a>>b>>c>>d>>p;
	x=p*a;
	if(p>=c) y=(p-c)*d+b;
	else y=b;
	if(x>y) cout<<y<<endl;
	else cout<<x<<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<cstdio>
#include<cmath>
#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+max(P-C,0)*D)<<endl;
    return 0;
}

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

C++: #include<iostream>
nameapce using std;
int main(){
	int a,b,c,d,p;
	cin>>a>>b>>c>>d>>p;
	if(a*c>b+d*(p-c)){
		printf("%d",b+d*(p-c));
	}
	else{
		printf("%d",a*c);
	}
	return 0;
}

C++: #include <stdio.h>

int main(void){
    int a,b,c,d,p;
    int costx, costy;
    
    scanf("%d%d%d%d%d", &a, &b, &c, &d, &p);
    costx = a*p;
    costy = b + (p>c?(p-c)*d:0);
    
    printf("%d\n", costx>costy?costy:costx);
      
    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;
	S=A*P;
	T=B+(P-C)*D;
	if (S<=T){
		cout<< S << endl;
	}
	else {
		cout<< T << endl;
	}
	return 0;
}

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

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

using namespace std;

typedef long long ll;

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

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;
	}

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

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

C++: #include "iostream"
#include "algorithm"
#include "string"
using namespace std;

int main() {
	int a, b, c, d, p;
	cin >> a >> b >> c >> d >> p;
	int cnt1 = 0, cnt2 = 0;
	int w1 = 0, w2 = 0;
	while (w1 < p) {
		w1++;
		cnt1 += a;
	}
	cnt2 += b;
	while (w2 < p) {
		if (w2 >= c) {
			cnt2 += d;
		}
		w2++;
	}
	cout << min(cnt1, cnt2) << endl;
}

C++: #include<bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n;i++)
using namespace std;
int main(){
  int a,b,c,d; cin>>a>>b>>c>>d;
  int joi; cin>>joi;
  int x=joi*a;
  int y=0;
  if(joi>=c){y+=b;y+=d*(joi-c);}
  else y=b;
  cout<<min(x,y)<<endl;
}

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

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

C++: #include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=1;i<=n;i++)
#define drep(i,n) for(int i=n;i>=0;i--)
#define INF 100000005
#define MAX 1002
#define mp make_pair
#define pb push_back
#define fi first
#define se second
using namespace std;
//__gcd(a,b), __builtin_popcount(a);

int main(){
	int a[5], t1, t2, ans = 0;
	rep(i,5)scanf("%d", &a[i]);
	t1 = a[0]*a[4];
	if(a[2] >= a[4])t2 = a[1];
	else t2 = a[1]+(a[4]-a[2])*a[3];
	printf("%d\n", min(t1, t2));
	return 0;
}

C++: #include <iostream>

using namespace std;

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

  if(x>y)cout<<y<<endl;
  else cout<<x<<endl;
  return 0;
}

C++: #include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <string>
#include <map>
#include <functional>
#include <cmath>
#include <cstdio>
using namespace std;

#define PI 4*atan(1)

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 + d * (p - c);
  }
  cout << min(x, y) << endl;
}

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(C>P){
        y=B;
    }else{
        y=(P-C)*D+B;
    }
    if(x>y){
        cout<<y;
    }else{
        cout<<x;
    }
    
    return 0;
}

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

int main(){

  int a,b,c,d,p;
  int vala=0,valb=0;

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

  vala = a*p;

  valb = b;

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

  if(vala>=valb){
    cout << valb<<endl;
  }else cout << vala<<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-C)*D)<<endl;
    return 0;
}