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 <algorithm>

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;
		
	int planX, planY;

	planX = A * P;

	if(C > P)
		planY = B;
	else
		planY = B + D * (P - C);

	if(planX < planY)
		cout << planX << endl;
	else
		cout << planY << endl;

	/*
	int A,B,C,D,E;
	cin >> A >> B >> C >> D >> E;

	int answer;
	if(A < 0){
		answer = -A * C + D + B * E;
	}
	if(A > 0){
		answer = (B - A) * E;
	}
	cout << answer << endl;
	*/

	return 0;
}

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*a<=c)x=b;
	else{y=e-c;x=y*d+b;}
	if(e*a<y)cout<<y;
	else cout<<e*a;
	cout<<endl;
}

C++: #include <stdio.h>

int main(){
  int i1[5] = {};
  int x,y;
  for(int n = 0; n < 5; n++)
    scanf("%d",&i1[n]);

  x = i1[0] * i1[4];
  if(i1[4] <= i1[2]) y = i1[1];
  else y = i1[1] + ((i1[4] - i1[2]) * i1[3]);
  
  if(x == y) printf("%d\n",x);
  else if(x > y) printf("%d\n",y);
  else if(x < y) printf("%d\n",x);
}

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 <bits/stdc++.h>
typedef long long LL;
using namespace std;

int main(){
  int A, B, C, D, E;
  cin >> A >> B >> C >> D >> E;
  int X = A * P;
  int Y = B + D * max(0, C - B);

  cout << min(X, Y) << endl;
}

C++: #include<stdio.h>
#include<algorithm>
using namespace std;
int main(){
	int a,b,c,d,p;
	scanf("%d%d%d%d%d",&a,&b,&c,&d,&p);
	printf("%d\n",min(a*p,b+max(0,p-c)*d));
}

C++: #include<iostream>
using namespace std;
int main(){
	int a,b,c,d,e,s,f,t;
	cin>>a>>b>>c>>d>>e;

	s=a*e;
	
	f=e-c;
	if(f>0){
	t=b+(d*f);
	}
	else{t=b;}
	
	if(s>t){swap(s,t);}

	cout<<s<<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){
      cout<<mizu1<<endl;
   } else {
      cout<<mizu2<<endl;
   }
   return 0;
}

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

C++: #include <iostream>

int main ()
{
    int a,b,c,d,e;

    std::cin >> a;
    std::cin >> b;
    std::cin >> c;
    std::cin >> d;
    std::cin >> e;

    int cost_a,cost_b;

    cost_a = a * e;

    if (c < e) {
        cost_b = b + (e - c) * d;
    } else {
        cost_b = b;
    }

    if (cost_a < cost_b) {
        std::cout << cost_a << std::endl;
    } else {
        std::cout << cost_b << std::endl;
    }



    return 0;
}

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

using namespace std;

int main()
{
  int A,B,C,D,P;
  cin>>A;
  cin>>B;
  cin>>C;
  cin>>D;
  cin>>P;

  // X社
  int X_sum = A * P;

  //Y社
  int Y_sum = B;
  if(P > C){
    Y_sum += D * (P - C);
  }

  int ans = min(X_sum,Y_sum);
  cout<<ans<<endl;

  return 0;
}

C++: #include<stdio.h>
#include<algorithm>
using namespace std;
int main(){
	int a,b,c,d,e;
	scanf("%d%d%d%d%d",&a,&b,&c,&d,&p);
	printf("%d\n",min(a,b+max(0,p-c)*d));
}

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

  int x,y;
  x = P*A;
  if(P<=C) y=B;
  else y=B+(P-C)*D;

  if(y>x) cout << x << endl;
  else cout << y << endl;
  return 0;
}

C++: //15-1 ?°´?????????
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
using namespace std;
int main(){
    int A,B,C,D,P;
    cin >> A >> B >> C >> D >> P;
    int X = P*A;
    int Y = B;
    if(P>C){
        Y += D*(P-C);
    }
    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 rest = (P - C) > 0 ? P - C : 0;
	cout << min(A * P, B + D * rest) << endl;
}

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

int main() {
	int A,B,C,D,P;
	cin >> A >> B >> C >> D >> P;
	int X=P*A;
	int Y=B+(P-C)*D;
	int S=P-C;
	if (S<=0){
		Y=B;
	}
	if(X<Y){
		cout << X << endl;
	}
	else cout << Y << endl;
	// your code goes here
	return 0;
}

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

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

using namespace std;

int a, b, c, d, p;
int ans, sum;

int main() {

	cin >> a >> b >> c >> d >> p;
	sum = a * p;

	if (c - p >= 0) sum <= b ? printf("%d\n", sum) : printf("%d\n", b);
	else {

		int x;
		x = p - c;
		x = d * x;

		sum <= x ? printf("%d\n", sum) : printf("%d\n", x+b);

	}

	return 0;

}

C++: #include<cstdio>
using namespace std;
int main()
{
	int a,b,c,d,p,x,y;
	scanf("%d %d %d %d %d",&a,&b,&c,&d,&p);
	x=a*p;
	if(p>c){
		y=p-c;
		y=y*d+b;
	}
	else{
		y=b;
	}
	if(x<y){
		printf("%d\n",x);
	}
	else{
		printf("%d\n",y);
	}
	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>c){
    b += d*(p-c);
  }

  a = a*c > b ? a*c : b;

  cout << a << endl;

  return 0;

}

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

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

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

  if(p-c>0)
    Y=(p-c)*d+b;

  else if(c>=p)
    Y+=b;


  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,e;
 cin>>a>>b>>c>>d>>e;
 cout<<min(e*a,b+(c<e?(e-c)*d:0))<<endl;
}

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(p<=c)
    sum_b=b;
  else if (p>c)
    sum_b=b+(b-c)*d;
  
  sum=min({sum_a,sum_b});

  cout<<sum<<endl;

  return 0;
}

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

C++: #include<bits/stdc++.h>
#include<algorithm>
#include<vector>
#include<queue>
using namespace std;
typedef long long ll;

int main(){
	int a,b,c,d,p;
	scanf("%d%d%d%d%d",&a,&b,&c,&d,&p);
	int x=a*p;
	int y=b; if(c<p) y+=(p-c)*d;
	printf("%d\n",min(x,y));
}