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

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

C++: #include<iostream>
using namespace std;
int main(){
    int a,b,c,d,p;
    int x,y;
    cin>>a>>b>>c>>d>>p;
    
    x=a*p;
    if(p>c){
        y=b+d*(p-c);
    }else{
        y=b;
    }
    if(x>y){
        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 mizu1,mizu2,tuika;
   tuika =0;
   mizu1 = a*p;
   if(p <= c){
      mizu2 = b;
   } else {
      for(int x=0;x < p-c;x++){
         tuika += d;
      }
      mizu2 = b + tuika;
   }
   if(mizu1 < mizu2){
      printf("%d \n", mizu1)
   } else {
      printf("%d \n", mizu2)
   }
   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+d*max(p-c,0))<<endl;
}

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

C++: #include <iostream>
#include <fstream>
#include <typeinfo>
#include <vector>
#include <stack>
#include <cmath>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <iomanip>
#include <cctype>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<25;
const ll INF=1ll<<50;
const double pi=acos(-1);
const double eps=1e-8;
const int mod=1e9+7;
const vi emp;
const int dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};

int a,b,c,d,p;

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

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

int main() {
	int A, B, C, D;
	int P;
	int X, Y;
	int water;
	scanf("%d%d%d%d%d", &A, &B, &C, &D, &P);
	X = A * P;
	if(P <= C){
		Y = B;
	}else{
		Y = B + D * (P - C);
	}
	water = min(X,Y);
	printf("%d\n", water);
	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<<endl;
	else cout<<k<<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 ans = min(a * p, (c >= p) ? b : b + (p - c) * d);

	printf("%d\n", ans);
}

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

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

int main(void) {
    int A,B,C,D,P;cin>>A>>B>>C>>D>>P;
    int X = P * A;
    int Y = B;
    if (P > C) {
        Y += (P - C) * D;
    }
    cout << min(X, Y) << endl;
    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 = 1;
    if(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++: #include<iostream>
using namespace std;
int main()
{
	unsigned int a, b, c, d, p, w_x, w_y;
	cin >> a;
	cin >> b;
	cin >> c;
	cin >> d;
	cin >> p;
	w_x = a * p;
	if (p < c){
		w_y = b;
	}
	else{
		w_y = b + (p - c) * d;
	}
	if (w_x < w_y){
		cout << w_x << endl;
	}
	else{
		cout << w_y << 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(C>P){
        y=B;
    }else{
        y=(P-C)*D+B;
    }
    if(x>y){
        cout<<y;
    }else{
        cout<<x;
    }
    cout<<endl;
    return 0;
}

C++: #include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <algorithm>
#include <numeric>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
#include <cassert>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define SORT(x) sort((x).begin(),(x).end())
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define repn(i,a,n) for(int (i)=(a);(i)<(int)(n);(i)++)
#define EQ(a,b) (abs((a)-(b))<eps)
int A,B,C,D,p;
int main()
{
	cin >> A;
	cin >> B;
	cin >> C;
	cin >> D;
	cin >> p;
	int X=0,Y=0;
	X = A*p;
	Y = B;
	if(p>C)Y += (p-C)*D;
	cout << min(X,Y) << endl;
	return 0;
}

C++: #include<algorithm>
#include<cstdio>
#include<iostream>
#include<cmath>
using namespace std;
int main(void){
	int A,B,C,D,P,ANS;
	cin>>A>>B>>C>>D>>P;
	if(P>C){B+=((P-C)*D);}
	ANS=min(A*P,B);
	cout<<ANS<<endl;
	return 0;
}

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

    if(p>c){
       y+=(p-c)*d;
    }
    
    if(x<y) cout<<x<<endl;
    else cout<<y<<endl;
}

C++: #include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) range(i,0,b)
#define pb(a) push_back(a)
#define all(a) (a).begin(), (a).end()
#define debug(x) cout << "debug " << x << endl;
using namespace std;

int main(){
    int charge, basic, limit, add, use;
    cin >> charge >> basic >> limit >> add >> use;
    charge*=use;
    if(limit < use) basic+=((use - limit) * add);
    cout << (charge < basic ? charge : basic)  << endl;
}

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

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