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 <bits/stdc++.h>
using namespace std;
int main()
{
  int a,b,c,d,l;
  cin >> a >> b >> c >> d >> l;
  cout << min(a * l,b + max(0,(l - c) * d)) << endl;
  return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <vector>

using namespace std;

int main(){
	
	int A, B, C, D, P;
	
	cin >> A >> B >> C >> D >> P;
	
	int cost1, cost2;
	
	cost1 = A * P;
	
	cost2 = max(0, P - C) * D + B;
	
	cout << min(cost1, cost2) << endl;
	
	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;
    int x=a*p;
    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(void)
{
    int moneyX,moneyY,maxY,plusY,use;
    cin>>moneyX>>moneyY>>maxY>>plusY>>use;
    if(maxY<use)moneyY+=(use-maxY)*plusY;
    if(moneyX * use <=  moneyY)cout<<moneyX*use<<endl;
    else cout<<moneyY<<endl;
}

C++: #include <bits/stdc++.h>
#define rep(i,n)for(long long i=0;i<(n);i++)
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
const ll INF=1e18;
const ll MOD=1e9+7;
const double pi=acos(-1);
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

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

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+((p-c>0)?(p-c)*d:0) ) << 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 <iostream>
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<bits/stdc++.h>
using namespace std;
int main(){
  int a,b,c,d,p;
  cin >> a >> b >> c >> d >> p;
  a = a*p;
  if(p>c) b += (p-c)*d;

  if(a<b){
    cout << a << endl;
  }
  else{
    cout << b << endl;
  }
  return 0;
}

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

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

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

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

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

  cout<<sum<<endl;

  return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int main(void)
{
	int A,B,C,D,P,all;
	scanf("%d %d %d %d %d",&A,&B,&C,&D,&P);
	if(P<=C){}
	else{
		B+=(P-C)*D;
	}
	all=min(A*P,B);
	printf("%d\n",all);
	return 0;
}
//9:53.939クリア

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

using namespace std;

int main(){

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

  x=a*p;
  
  if(c>=p)
	y=b;
  else
	y=b+d*(p-c);

  cout<<min(x,y)<<endl;

}

C++: #include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<cmath>
#include<utility>
#include<set>
#include<complex>
#include<map>
#define vi vector<int>
#define vvi vector<vector<int> >
#define ll long long int
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
#define ld long double
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define CC puts("-------ok--------");
#define all(in) in.begin(), in.end()
using namespace std;
typedef pair<int, int> pii;
#define MAX 99999999
int main(){
    int a,b,c,d,e;
    cin>>a>>b>>c>>d>>e;
    int cost,cost2;
    cost=a*e;
    cost2=b;
    e>c ? cost2+=(e-c)*d:cost2=cost2;
    cout<<min(cost2,cost)<<endl;
}

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

C++: #include <bits/stdc++.h>
#define rep(i,j,k) for(int i=(int)j;i<(int)k;i++)
#define itrep(i,x) for(auto i=(x).begin(); i!=(x).end();i++)
#define Sort(x) sort((x).begin(),(x).end())
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define vi vector<int>
#define INF (int)1e9
#define INFL 1e18
#define MOD 1000000007
#define pb push_back
#define MP make_pair
#define PI 3.1415926535
typedef long long int ll;
typedef std::pair<int,int> P;
int D=1;
int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

using namespace std;

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

	if(P*A<(P-C)*D+B){
	cout<<P*A << endl ;
	}else{
	cout<<(P-C)*D+B<< endl;}
	}
  return(0);
}

C++: #include<stdio.h>
main(){
  int x1,y1,y2,y3;
  int con;
  int x,y;
  scanf("%d",&x1);
  scanf("%d",&y1);                                                        
  scanf("%d",&y2);                                                        
  scanf("%d",&y3);                                             
  scanf("%d",&con);

  x=x1*con;
  if(con < y2){
    y=y1;
  }else{
    y= y1 + (con-y2)*y3;
  }
  if(x>y){
    printf("%d\n",y);
  }else if(x<y){
    printf("%d\n",x);
  }else{
    printf("%d\n",x);
  }
}