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>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
 
//const int dx[] = {1, 0, -1, 0, 1, -1, -1, 1};
//const int dy[] = {0, 1, 0, -1, 1, 1, -1, -1};
 
int main()
{
	int a, b, c, d, p;
	cin >> a >> b >> c >> d >> p;

	int ans1 = 0;
	int tmp = p;
	while (tmp > 0){
		ans1 += a;
		tmp--;
	}

	int ans2 = 0;
	if (p < c) ans2 = b;
	else {
		ans2 += b;
		p -= c;
		while (p > 0){
			ans2 += d;
			p--;
		}
	}

	cout << (ans1 < ans2 ? ans1 : ans2) << 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;
    if(P>C){
        Y += D*(P-C);
    }
 
    if(X<Y){
        cout << X << endl;
    }
    else{
        cout << Y << endl;
    }




return 0;
}

C++: #include<iostream>
#include<stdio.h>
#include<math.h>
int main(){
 int a=0,b=0,c=0,d=0,p=0;
 int e=0;
 cin>>a>>b>>c>>d>>p;
 if(p<=c){
  e=b;
 }
 else{
  e=b+(p-c)*d;
 }

 cout<<e<<endl;
return 0;
}

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

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

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

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{
			p - c;
			Y = c*d + b;
		}

		if (Y < X){
			cout << Y << endl;
		}
		else{
			cout << X << endl;
		}

	return 0;
}

C++: 
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <algorithm>
#include <math.h>
#include <utility>
#include <set>
#include <map>
#define INF 100000
#define rep(i,n) for(int i =0;i<n;i++)
using namespace std;
typedef long long int ll;


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

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

int main()
{
  int a, b, c, d, p;
  int res1, res2;

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

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

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

C++: #include<cstdio>
using namespace std;
int main(void)
{
	int a,b,c,d,i,p,x,y,sa;
	scanf("%d",&a);
	scanf("%d",&b);
	scanf("%d",&c);
	scanf("%d",&d);
	scanf("%d",&p);
	x=a*p;
	if(c>=p){
		y=b*p;
	}
	else{
		sa=p-c;
		y=d*sa+b;
	}
	if(x>y) printf("%d\n",y);
	else{ printf("%d\n",x);}
	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;
 return 0;
 }

C++: #include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define enld '\n'
#define rep(i,n) for(int i=0; i<(n); i++)
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("Ofast")
constexpr ll INF = 1e18;
constexpr int inf = 1e9;
constexpr ll mod = 1000000007;
constexpr ll mod2 = 998244353;
const double PI = 3.1415926535897932384626433832795028841971;
const int dx[6] = {1, 0, -1, 0,1,1};
const int dy[6] = {0, 1, 0, -1,1,-1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
// ---------------------------------------------------------------------------

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int A,B,C,D,p;
    cin >> A >> B >> C >> D >> p;
    cout << min(A*p , B+max(0,p-C)*D) << enld;
    
    return 0;
}

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

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

C++: #include <algorithm>
#include <iostream>
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) * D, 0)) << endl;
}

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

int main(){
	/*
	int a,b,c,d,e;

	cin >> a >> b >> c >> d >> e;

	int x;

	if(a > 0){
		x = e*(b-a);
	}
	if(a == 0){
		x = e*b + d;
	}
	if(a < 0){
		x = -c*a + e*b + d;
	}

	cout << x <<endl;
	*/

	/*
	int a,b,c,d,e,f;
	cin >> a >> b >> c >> d >> e >> f;
	int m,n;
	int x = a + b + c + d + e + f;


	
	if(e<f)
	{
		x = x - e;
		if(a<b)
		{
			if(a<c)
			{
				if(a<d)
				{
					cout << x-a << endl;
				}
				else
				{
					cout << x-d << endl;
				}
			}
			else
			{
					if(c<d)
				{
					cout << x-c << endl;
				}
				else
				{
					cout << x-d << endl;
				}
			}
		}
		else
		{
			if(b<c)
			{
				if(b<d)
				{
					cout << x-b << endl;
				}
				else
				{
					cout << x-d << endl;
				}
			}
			else
			{
					if(c<d)
				{
					cout << x-c << endl;
				}
				else
				{
					cout << x-d << endl;
				}
			}
		}
	}
	else
	{
		x = x - f;
		if(a<b)
		{
			if(a<c)
			{
				if(a<d)
				{
					cout << x-a << endl;
				}
				else
				{
					cout << x-d << endl;
				}
			}
			else
			{
					if(c<d)
				{
					cout << x-c << endl;
				}
				else
				{
					cout << x-d << endl;
				}
			}
		}
		else
		{
			if(b<c)
			{
				if(b<d)
				{
					cout << x-b << endl;
				}
				else
				{
					cout << x-d << endl;
				}
			}
			else
			{
					if(c<d)
				{
					cout << x-c << endl;
				}
				else
				{
					cout << x-d << endl;
				}
			}
		}
	}
	*/
/*
	int n;
	cin >> n;
	int a;
	cin >> a;
	int max = a,min = a;
	int i = 1;
	while(i<n){
		cin >> a;
		if(a > max){
			max = a;
		}
		if(a < min){
			min = a;
		}
		i++;
	}
	cout << max << endl << min << endl;
	*/
	/*
	string s;
	cin >> s;
	int j,o,i;
	for(int i;i < s.size;i++){
		
	}
	*/
	/*
	int n;
	cin >> n;
	int A;
	int X[100000];
	int n=0;
	for(int i=0;i<n;i++){
		cin >> A;
		
	}
	*/

	int a,b,c,d,p;
	cin >> a >> b >> c >> d >> p;
	int X,Y=b;

	X = a*p;
	
	if(p>c){
		Y += d*(p-c);
	}

	if(X > Y){
		cout << Y;
	}
	else{
		cout << X;
	}

	return 0;
}

C++: #include<iostream>
#include<iomanip>
#include<algorithm>
#include<cctype>
#include<cmath>
#include<string>
#include<set>
#include<map>
#include<queue>
#include<vector>
using namespace std;

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

	int X, Y;
	X = P * A;
	Y = (P > C) ? B + (P - C) * D : B;

	cout << min(X, Y) << endl;

	return 0;
}