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>
#include <algorithm>
#include <functional>
#include <vector>
#include <string>

#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;

int main(){

	int a,b,c,d,p,res;

	cin >> a >> b >> c >> d >> p;
	
	if(p < c) res = b;
	else if(c < p) res = b + (d * (p - c));

	cout << ((a*p > res) ? res : a*p) << endl;

	return 0;
}

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

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

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

	return 0;
}

C++: #include<iostream>
#include<cstdio>
using namespace std;
int main()
{
	int a,b,c,d,e,s,i,ans,k;
	cin>>a>>b>>c>>d>>e;
	s=a*e;
	if(e<=c)k=b;
	else 
	{
		k=((e-c)*d)+b;
	}
	if(k>=s)cout<<s;
	else cout<<k;
	return 0;
}

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

typedef long long lli;
lli A, B, C, D, P;

lli F1() {
  return A * P;
}

lli F2() {
  if(P <= C) return B;
  else return B + (P - C) * D;
}

int main() {
  while(cin >> A >> B >> C >> D >> P) {
    cout << min(F1(), F2()) << 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 (P<=C,S<=T){
	S=A*P;
	cout<< S << endl;
	}
	else {
		T=B+(P-C)*D;
		cout<< T << endl;
	}
	// your code goes here
	return 0;
}

C++: #include<iostream>

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 + (P - C) * D;
	else
		Y = B;
	if(X > Y)
		cout << Y << endl;
	else 
		cout << X << 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;
	
	y = B;
	if( p > C){
		y = (( p - C) * D) + y;
	}
	
	if( x < y){
		printf("%d\n", x);
	}else{
		printf("%d\n", y);
	}
	return 0;
}

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

C++: #include<bits/stdc++.h>
using namespace std;
int A,B,C,D,P;

int main(){
  cin>>A>>B>>C>>D>>P;
  cout<<min(A*P,B+(P-C)*(C<P?D:0))<<endl;
  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 > 0) b += d * (p - c);
  cout << min(a*p, b)<< endl;
  return 0;
}

C++: #include<iostream>
#include<vector>
#include<string>
#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;
}

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

using lint = long long;
using ldouble = long double;

void solve() {
    int a, b, c, d, p;
    std::cin >> a >> b >> c >> d >> p;
    std::cout << std::min(a * p, b + std::max(0, p - c) * d)
              << std::endl;
}

int main() {
    std::cin.tie(nullptr);
    std::cout.tie(nullptr);
    std::ios::sync_with_stdio(false);

    solve();

    return 0;
}

C++: #include <iostream>
using namespace std;
int main(void){
    // Your code here!
   int A, B, C, D, P;
   cin >> A >> B >> C >> D >> P;
   //x
   int x = A * P;
   
   //y
   int y;
   if(P <= C) y = B;
   else y = B + D * (P - C);
   
   if(x > y) cout << y << endl;
   else cout << x << 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(p<c){
		y=b;
	}else if(p>c){
		y=b+(p-c)*d;
	}
	if(x>y){
		cout << y << endl;
	}else if(x<y){
		cout << x << endl;
	}
	return 0;
}

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

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

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

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

		cout << r << endl;

	return 0;
}

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

C++: #include<iostream>
#include<string>
#include<map>
#include<queue>
#include<string>
#include<cstring>
#include<algorithm>
#include<ctype.h>
#include<cstdio>
using namespace std;
main(){
  int x,y;
  int c,d,p;
  cin>>x>>y>>c>>d>>p;
  x=x*p;
  if(c<p){
    y=y+(p-c)*d;
  }
  if(x<y){
    cout<<x<<endl;
    }
  else{
    cout<<y<<endl;
  }
}

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

#include <iostream>
using namespace std;

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

    x=a*p;
    y=b;
	if( c<p)y=b+(p-c)*d;
    s=x;
    if( x>y)s=y;
    cout<<s<<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>

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

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

int rate(int a,int b,int c,int d,int p){
    int x,y;
    x=a*p;
    if(p>c){
        y=b+d*(p-c);
    }else{
        y=b;
    }
    if(x>y){
        return y;
    }else{
        return x;
    }
}

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

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

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

using namespace std;

int A, B, C, D, P;

int main() {
	int totalX, totalY;

	cin >> A >> B >> C >> D >> P;
	totalX = A*P;
	totalY = B + max(0, P - C)*D;
	cout << min(totalX, totalY) << endl;

	return 0;
}