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

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

C++: #include <stdio.h>

int main(){
    int a,b,c,d,p,x,y;
    scanf("%d",&a);
    scanf("%d",&b);
    scanf("%d",&c);
    scanf("%d",&d);
    scanf("%d",&p);
    x=a*p;
    if(p<=c){
	y=b;
    }
    else {
	y=(p-c)*d+b
    }	
    for(i=0;i<5;i++){
	scanf("%d
    printf("%d\n",ave);
    return 0;
}

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

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

using namespace std;

int main(){
  int a,b,c,d,p;
  int sum=0,sum_a=0,sum_b=0;

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

  sum_a=a*p;

  if(b<=c)
    sum_b=b;
  else if (b>c)
    sum_b=b+(b-c)*d;
  
  sum=min({sum_a,sum_b});

  cout<<sum<<endl;

  return 0;
}

C++: #include <iostream>
using namespace std;
int main(void){
    int A,B,C,D,P,x,z;
    cin >> A >> B >> C >> D >> P;
    x=P*A;
    if(P<=C){
        if(x>B){
            cout << B << endl;
        }
        else if(x<B){
            cout << x << endl;
        }
    }
    if(P>C){
        z=B+(P-C)*D;
        if(x>z){
            cout << z << endl;
        }
        else if(x<z){
            cout << x << endl;
        }
    }
}

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

C++: #include <iostream>
#include<cstdlib>
#include<queue>
#include<set>
#include<vector>
#include<string>
#include<algorithm>
#include<stack>
#include<map>
#include<cstdio>
#include<fstream>
using namespace std;
#define rep(i,a) for(int i=0;i<a;i++)

#define mp make_pair
#define P pair<int,int>
#define ll __int64
int a,b,c,d,p;
int main(){
	cin>>a>>b>>c>>d>>p;
	int use=p;
	if(p<=c)use=0;
	else use=p-c;
	cout<<min(a*p,b+use*d)<<endl;
	return 0;
}

C++: #include<stdio.h>

int main(){
int A,B,C,D,P;
scanf("%d%d%d%d%d",&A,&B,&C,&D,&P);
printf("%d\n",(A*P<(P<C?B:B+D*(P-C))?A*P:(P<C?B:B+D*(P-C))));
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<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<stdio.h>
using namespace std;

int main() {
    int a,b,c,d,p,A,B,i;
    cin >> a >> b >> c >> d >> p;
    A = a*p;
    B = 0;
    i = 0;
    if(p > c){
        p = p - c;
        while(1){
            p = p - 1;
            i ++;
            if(p < 1){
                break;
            }
        }
        B = b+i*d;
        
    }else{
        B = b;
    }
 
    if(A < B){
        p = A;
    }else if(A > B){
        p = B;
    }else{
        p = A;
    }
    
    cout << p << endl;
    
}

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

C++: #include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
  int a,b,c,d,p;
  cin>>a>>b>>c>>d>>p;
  cout<<min(a*p,b+max(0LL,p-c)*d)<<endl;
  return 0;
}

C++: #include <iostream>
using namespace std;
int main(void){
    int xl, yk, ym, yl, j;
    int i, k, c, xt, yt;

    cin >> xl;
    cin >> yk >> ym >> yl;
    cin >> j;

    xt = xl * j;
    yt = yk;
    if ((j - ym) > 0) {
        yt += (yl * (j - ym));
    }
    if (xt < yt) {
        cout << xt << endl;
    } else {
        cout << yt << endl;
    }
    return 0;
}

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

using namespace std;

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