https://www.acmicpc.net/problem/10707
#include <iostream> using namespace std; int main() { int a,b,c,d,p; cin>>a>>b>>c>>d>>p; int sum=p*a; int sum1=0; if(p<=c) sum1=b; else sum1=b+(p-c)*d; cout<<min(sum,sum1); }