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

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

#include<algorithm>

int main(){

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

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

		if (y < x){
			cout << y << endl;
		}
		else{
			cout << x << endl;
		}

	return 0;
}

C++: #include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define it ::iterator
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double ESP=1e-10;
using namespace std;
int main(){
  int a,b,c,d,e;
  cin>>a>>b>>c>>d>>e;
  int X,Y;
  X=e*a;
  Y=b;
  if(e>c)
    Y+=(e-c)*d;
  cout<<min(X,Y)<<endl;


}

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;

#include<algorithm>

int main(){

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

	if (p <= c) cout << min(p * a, b);
	else cout << min(p * a, b + (p - c) * d);
}

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

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

int main(){
	int a,b,c,d,e;
	cin>>a>>b>>c>>d>>e;
	
	int aa,ab;
	aa=a*e;
	if(c>=e){
		ab=b;
		}
		else{
			ab=b+((e-c)*d);
			}
			
			if(aa>=ab){
				cout<<ab<<endl;
				}
				
			else{
				cout<<aa<<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 cost = 0;
	if (p <= c) { cost = b; }
	else {
		cost = b + (p - c)*d;
	}
	cost = min(a*p, cost);
	cout << cost << endl;
}

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;
}

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

		if (y < x){
			cout << y << endl;
		}
		else{
			cout << x << endl;
		}

	return 0;
}

C++: #include<iostream>
using namespace std;
int main() {
	int x, y, max, py, num;
	cin >> x >> y >> max >> py >> num;
	if (max < num) y = py*(num - max) + y;
	if (y < x*num) cout << y << endl;
	else cout << x*num << endl;
	return 0;
}

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

C++: #include<stdio.h>
int main(void)
{
	int A,B,C,D,P;
	int a,b1,b2,b;
	scanf("%d",&A);
	scanf("%d",&B);
	scanf("%d",&C);
	scanf("%d",&D);
	scanf("%d",&P);
	a=A*P;
	if(C<P){
		b1=P-C;
		b2=b1*D;
	}
	b=B+b2;
	if(a<=b){
		printf("%d",a);
	}
	else if(b<a){
		printf("%d",b);
	}
	return 0;
}

C++: #include <cstdio>

using namespace std;

int main(void)
{
	int a, b, c, d, p;
	int A = 0, B = 0;
	
	scanf("%d%d%d%d%d", &a, &b, &c, &d, &p);
	
	A = a*p;
	if (c >= p){
		B = b;
	}
	else {
		B = b + d * (p - c);
	}
	
	if (A < B){
		printf("%d\n", A);
	}
	else {
		printf("%d\n", B);
	}
}

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;
 }

 cout<<e<<endl;
return 0;
}

C++: #include <cstdio>

int main() {

    return 0;
}

C++: #define _USE_MATH_DEFINES
#define INF 0x3f3f3f3f

#include <iostream>
#include <cstdio>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>
#include <cctype>
#include <utility>
  
using namespace std;
  
typedef long long ll;
typedef pair <int,int> P;
typedef pair <int,P> PP;
  
static const double EPS = 1e-8;
  
static const int tx[] = {0,1,0,-1};
static const int ty[] = {-1,0,1,0};

int main(){
  int x_price_per_liter;
  while(~scanf("%d",&x_price_per_liter)){
    int y_base_price;
    int y_upper_limit;
    int y_additional_price;
    int consumption_amount;
    scanf("%d",&y_base_price);
    scanf("%d",&y_upper_limit);
    scanf("%d",&y_additional_price);
    scanf("%d",&consumption_amount);
    printf("%d\n",min(consumption_amount * x_price_per_liter,
                    y_base_price + (consumption_amount <= y_upper_limit ? 0 : (y_upper_limit - consumption_amount) * y_additional_price)));
  }
}

C++: #include<bits/stdc++.h>
using namespace std;
signed main()
{
  int a,b,c,d,e,x,z;
  cin>>a>>b>>c>>d>>e;
  z=a*e;
  if(e<=20){
    x=100;
  }
  else{
    if(c>e){
      x=b;
    }
    else{
      x=(e-c)*d+b;
    }
  }
  if(z<x){
    cout<<z<<"\n";
  }
  else{
    cout<<x<<"\n";
  }
  return(0);
}