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<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<iostream>
#include<string>
#include<vector>
#include<utility>
#include<queue>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<cstring>
#define INF 2147483647
#define llINF 9223372036854775807
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long

using namespace std;
int main(){
  int a,b,c,d,e;
  cin>>a>>b>>c>>d>>e;
  int x=a*e;
  int y=b;
  if(e-c>=0)
    y+=(e-c)*d;
  cout<<min(x,y)<<endl;
  return 0;
}

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

int a, b, c, d, p;
int x, y; 

int main()
{  
  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;

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

C++: #include<stdio.h>
int main(void)
{
	int A,B,C,D,P;
	int a,b1,b2,b;
	scanf("%d",&A);
	scanf("%d",&B);
	scanf("%d",&C);
	scanf("%d",&D);
	scanf("%d",&P);
	a=A*P;
	if(C<P){
		b1=P-C;
		b2=b1*D;
	}
	b=B+b2;
	if(a<=b){
		printf("%d",a);
	}
	else if(b<a){
		printf("%d",b);
	}
	return 0;
}

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

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 += d * (p-c);
	}
	cout << min(x, 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;
	}
	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;
	cin>>a>>b>>c>>d>>p;
	if(p<=c){
		if(p*a<b) cout<<p*a<<endl;
		else cout<<b<<endl;
	}
	else{
		if(p*a<b+(p-c)*d) cout<<p*a<<endl;
		else cout<<b+(p-c)*d<<endl;
	}
	return 0;
}

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

#define llong long long
#define inf 999999999
#define mp make_pair
#define pb push_back
#define fn fill_n
typedef pair<int, int> P;
typedef pair<P, int> PP;
typedef pair<PP, int> PPP;
typedef struct data{
	int now;
	int cost;
}data;
int nh[4] = {1, 0, -1, 0};
int nw[4] = {0, 1, 0, -1};





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

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

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

}

C++: #include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
template<class T>
using Table = vector<vector<T>>;
const ld eps=1e-9;

//// < "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\a.txt"
int main() {
	int A, B, C, D, P; cin >> A >> B >> C >> D >> P;
	int ans = A*P;
	int nans;
	if (C < P)nans = B;
	else nans = B + (P - C)*D;
	cout << min(ans, nans) << 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;
    }
    
    cout << min(X, Y) << endl;
    return (0);
}

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

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

    int x=a*p;
    int y=b+max(0,p-c)*d;

    cout<<min(x,y)<<endl;
    return 0;
}

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

#define times(n, i)      uptil(0, n, i)
#define upto(f, t, i)    for(decltype(t) _##i = (t), i = (f); i <= _##i; i++)
#define uptil(f, t, i)   for(decltype(t) _##i = (t), i = (f); i < _##i; i++)
#define downto(f, t, i)  for(decltype(t) _##i = (t), i = (f); i >= _##i; i--)
#define downtil(f, t, i) for(decltype(t) _##i = (t), i = (f); i > _##i; i--)
#define unless(c) if(!(c))
#define until(c) while(!(c))
#define loop while(true)

#define all(v) v.begin(), v.end()
#define ln << "\n"

struct line{};

template<class T> istream& operator>>(istream& in, vector<T>& v) {
    times(v.capacity(), i) in >> v[i];
    return in;
}

template<class T> const ostream& operator<<(ostream& out, const vector<T>& v) {
    times(v.size(), i) out << (i ? " " : "") << v[i];
    return out;
}

template<class T, class...U> typename enable_if<is_same<T, line>::value, string>::type next(istream& in, const U&... args) {
    string s;
    getline(in, s, args...);
    return move(s);
}

template<class T, class...U> typename enable_if<!is_same<T, line>::value, T>::type next(istream& in, const U&... args) {
    T t(args...);
    in >> t;
    return move(t);
}
template<class T, class...U> auto next(const U&... args) -> decltype(next<T>(cin)) {
    return next<T>(cin, args...);
}

template<class T> T sum(const vector<T>& v) {
    T ans = T();
    for(const T& t : v) ans += t;
    return ans;
}

template<class T> T sum(const typename vector<T>::iterator& begin, const typename vector<T>::iterator& end) {
    T ans = T();
    for(typename vector<T>::iterator t = begin; t != end; t++) ans += *t;
    return ans;
}

template<class T> T min(const vector<T>& v) {
    return *min_element(v.begin(), v.end());
}

template<class T> T min(const typename vector<T>::iterator& begin, const typename vector<T>::iterator& end) {
    return *min_element(begin, end);
}

template<class T> T max(const vector<T>& v) {
    return *max_element(v.begin(), v.end());
}

template<class T> T max(const typename vector<T>::iterator& begin, const typename vector<T>::iterator& end) {
    return *max_element(begin, end);
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);

    int A = next<int>(), B = next<int>(), C = next<int>(), D = next<int>(), P = next<int>();

    cout << min(A * P, B + D * max(P - C, 0)) ln;

    return 0;
}

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

C++: #include<bits/stdc++.h>
#define int long long int
#define MP make_pair
#define PB push_back
#define F first
#define S second
using namespace std;
typedef vector<int> VI;
typedef pair<int, int> PII;
typedef vector<PII> VP;

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

  y = b;

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

  cout << min(x, y) << endl;
  
  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+d*p-d*c;
  }
  else{y=b;}
  if(x>y){
    cout<<y<<endl;
  }
  else{cout<<x<<endl;}
    return 0;
}