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>
using namespace std;

int main(){

    long int a,b,c,d,p;
    cin >> a >> b >> c >> d >> p;

    if(p<=c){
        if(a*p<=b){
        cout << a*p;
        }else if(a*p>=b){
        cout << b;
        }
    }

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



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

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

C++: #define _USE_MATH_DEFINES
#include "bits/stdc++.h"
using namespace std;

//#define int long long
#define DBG 1
#define dump(o) if(DBG){cerr<<#o<<" "<<o<<endl;}
#define dumpc(o) if(DBG){cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define each(it,c) for(auto it=(c).begin();it!=(c).end();it++)
#define all(c) c.begin(),c.end()
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9 + 7);

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

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

		if (Y < X){
			cout << Y << endl;
		}
		else{
			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;
  
  int X=A*P;
  int Y=B;
  
  if(P>C)Y+=(P-C)*D;

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

}

C++: //============================================================================
// Name        : JOI.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
using namespace std;
int A,B,C,D,P;
int main() {
	cin>>A>>B>>C>>D>>P;

	int S,T;
	S=P*A;
	if(C<P)T=B+(P-C)*D;
	if(C>P || C==P)T=P*B;

	if(S>T)cout<<T<<endl;
	if(S<T)cout<<S<<endl;
	if(S==T)cout<<S<<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 = P * A;
	
	if (P > C)
		Y = B + (P - C) * D;
	else
		Y = B;

	if (X > Y)
		cout << Y << endl;
	else
		cout << X << endl;

	return 0;
}

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

	return 0;
}

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

#include<algorithm>

int main(){

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

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

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

using namespace std;

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

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

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

C++: #include<iostream>
#include<string>
#include<algorithm>	
#include<cmath>
using namespace std;
int main(void) {
	int n, a, b, c, d; cin >> n >> a >> b >> c >> d;
	cout << min(n * d, a + max(0, d - b) * c) << endl;
}

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

int main() {
int x,y,a,b,c,d;
cin >> a;
cin >> b;
cin>>c;
cin>>d;
cin>>p;
x=a*p;
if(p<=c){y=b;}
else{y=b+y*d-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,S=0,T=0;
	cin >> A >> B >> C >> D>> P;
	if (C>P){
	S=A*P;
	cout<< S << endl;
	}
	else{
	T=B+(P-C)*D;
	cout<< T << endl;
	}


	// your code goes here
	return 0;
}

C++: #include<stdio.h>

int	main(){
	int A, B, C, D, P,	X,	Y;
	scanf("%d%d%d%d%d",	&A,	&B,	&C,	&D,	&P);
	X	=	A	*	P;
	Y	=	B;
	if(P	>	C)Y	+=	D	*	(P	-	C);
	if(X	>=	Y)printf("%d\n",	Y);
	if(Y	>	X) printf("%d\n",	X);
	return	0;
}

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

using namespace std;

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

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

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


int main(){
  int a,b,l,d,w;
  cin>>a>>b>>l>>d>>w;
  int x,y;
  x=w*a;
  l=w-l;
  if(l<0){l=0;}
  y=b+l*d;
  x=min(x,y);
  cout<<x<<endl;
  
  return 0;
}

C++: #include<stdio.h>
int main(void)
{
    int a,b,c,d,e;
	scanf("%d",&a);
	scanf("%d",&b);
	scanf("%d",&c);
	scanf("%d",&d);
	scanf("%d",&e);
	printf("%d\n",(g*a)>(c+(e*d)));
	else {
	    printf("%d\n",(c+(e*d))>g*a);
	}
	return 0;
}