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

C++: #include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <complex>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <iomanip>
#include <assert.h>
#include <array>
#include <cstdio>
#include <cstring>
#include <random>
#include <functional>
#include <numeric>
#include <bitset>
#include <fstream>

using namespace std;

struct before_main{before_main(){cin.tie(0); ios::sync_with_stdio(false);}} before_main;

#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define all(c) (c).begin(), (c).end()
#define zero(a) memset(a, 0, sizeof a)
#define minus(a) memset(a, -1, sizeof a)
#define watch(a) { cout << #a << " = " << a << endl; }
template<class T1, class T2> inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); }
template<class T1, class T2> inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); }

typedef long long ll;
int const inf = 1<<29;

int main() {

  int a, b, c, d; cin >> a >> b >> c >> d; int p; cin >> p;
  int aa = p * a;
  int bb = b + (c > p ? 0 : (p-c)*d);
  cout << (aa < bb ? aa : bb) << endl;
  
  return 0;
}

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

int main() {
int x,y,a,b,c,d,p;
cin >> a;
cin >> b;
cin>>c;
cin>>d;
cin>>p;
x=a*p;
if(p<=c){y=b;}
else{y=b+p*d-c*d;}
if(x<=y){cout<<x<<endl;}
else{cout<<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;
  if (p <= c) y = b;
  else y = b + d * (p - c);
  cout << min(x, y) << "\n";
}

C++: #include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <cmath>
#include <ctime>
#include <cctype>
#include <climits>
#include <iostream>
#include <string>
#include <array>
#include <vector>
#include <map>
#include <list>
#include <queue>
#include <deque>
#include <algorithm>
#include <numeric>
#include <utility>
#include <complex>
#include <memory>
#include <functional>

using namespace std;

#define ALL(a) (a).begin(),(a).end()
#define REP(index, begin, end) for (int (index) = (begin); (index) < (end); (index)++)
#define RE(index, end) REP(index, 0, end)
#define INF INT_MAX / 3
#define LLINF LLONG_MAX / 3
#define DINT(x) printf(#x " = %d\n", x);
#define GETINT(x) scanf("%d", &x)
#define GETLL(x) scanf("%lld", &x)
#define GETSTR(x) scanf("%s", x)

typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<double> vd;
typedef pair<int, int> pii;
typedef pair<long, long> pll;
typedef long long ll;

int main()
{
	int x_litter, y_kihon, y_lit_max, y_litter, usage;
	GETINT(x_litter);
	GETINT(y_kihon);
	GETINT(y_lit_max);
	GETINT(y_litter);
	GETINT(usage);
	int x_cost = x_litter * usage,
		lit = usage - y_lit_max,
		y_cost = y_kihon;
	if (lit > 0)
	{
		y_cost += lit * y_litter;
	}

	if (x_cost < y_cost)
	{
		printf("%d\n", x_cost);
	}
	else
	{
		printf("%d\n", y_cost);
	}
	return 0;
}

C++: #include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <vector>

using namespace std;
using ll = long long;

#define all(c) (c).begin(), (c).end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)
#define fr first
#define sc second

const ll INF = 1e9;
const ll MOD = 1e9 + 7;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

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

C++: #include<iostream>
#include<string>
using namespace std;
int main(){
    int a,b,c,d,p;
    cin>>a>>b>>c>>d>>p;
    int e;
    if(p-c>=0){
        e=b+(p-c)*d;
      }
      else{e=b;}
    if(p*a<=e){
     cout<<p*a;
    }
    else{
        if(p-c>=0){
        cout<<b+(p-c)*d;
      }
      else{cout<<b;}
    }
    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 <iostream>
#include <algorithm>
using namespace std;

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

C++: #include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b,c,d,e;
  cin>>a>>b>>c>>d>>e;
  cout<<min(a*e,b+max(0,(e-c)*d))<<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;

    int sum1, sum2;

    sum1 = a * p;

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

    cout << min(sum1, sum2) << endl;

    return 0;

}

C++: #include <iostream>
#include <algorithm>
using namespace std;
int main()
{
 int a,b,c,d,e;
 cin<<a<<b<<c<<d<<e;
 cout<<min(e*a,b+(c<e?(e-c)*d:0))<<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(a*p,b+max(0,p-c)*d)<<endl;
	
	return 0;
}

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

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

    const int cost_x = a * p;
    const int cost_y = (p < c) ? b : b + (p - c) * d;
    const int cost = min(cost_x, cost_y);

    cout << cost << endl;
}

C++: #include<stdio.h>
int main(void)
{
	int a,b,c,d,p,s,ss;
	scanf("%d",&a);
	scanf("%d",&b);
	scanf("%d",&c);
	scanf("%d",&d);
	scanf("%d",&p);
	s=a*p;
	if(c<p){
		ss=b+d*(p-c);
	}
	else{
		ss=b;
	}
	if(s<ss){
		printf("%d\n",s);
	}
	else{
		printf("%d\n",ss);
	}
	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,(C >= P ? B : B + (P-C)*D)) << endl;
  return 0;
}

C++: #include <stdio.h>
#include <vector>
#include <algorithm>
#include <math.h>

using namespace std;

int main(){

	int x_per,y_base,y_base_limit,y_delta,P;
	int x_sum = 0,y_sum = 0;

	scanf("%d\n%d\n%d\n%d\n%d",&x_per,&y_base,&y_base_limit,&y_delta,&P);

	x_sum = P*x_per;

	y_sum += y_base;

	if(P > y_base_limit){
		y_sum += y_delta*(P-y_base_limit);
	}

	printf("%d\n",min(x_sum,y_sum));

    return 0;
}

C++: #include <iostream>
using namespace std;
int main(void){
    int a,b,c,d,p,x,y,mon;
    cin>>a;
    cin>>b;
    cin>>c;
    cin>>d;
    cin>>p;
    x=p*a;
    if(p<=c){
        y=b;
    }
    if(p>c){
        y=b+(p-c)*d;
    }
    if(y>x){
    mon=x;
    }
    if(y<x){
        mon=y;
    }
    cout<<mon<<endl;
}

C++: #include<iostream>
#include<algorithm>
int main() {
	int a, b, c, d, p,A,B;
	std::cin >> a >> b >> c >> d >> p;

	A = a*p;

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

	std::cout << std::min(A, B) << std::endl;

	return 0;
}