Problem:
Score : 100 points

Problem Statement

There is a hotel with the following accommodation fee:

X yen (the currency of Japan) per night, for the first K nights

Y yen per night, for the (K+1)-th and subsequent nights

Tak is staying at this hotel for N consecutive nights.
Find his total accommodation fee.

Constraints

1 \leq N, K \leq 10000

1 \leq Y < X \leq 10000

N,\,K,\,X,\,Y are integers.

Input

The input is given from Standard Input in the following format:

N
K
X
Y

Output

Print Tak's total accommodation fee.

Sample Input 1

5
3
10000
9000

Sample Output 1

48000

The accommodation fee is as follows:

10000 yen for the 1-st night

10000 yen for the 2-nd night

10000 yen for the 3-rd night

9000 yen for the 4-th night

9000 yen for the 5-th night

Thus, the total is 48000 yen.

Sample Input 2

2
3
10000
9000

Sample Output 2

20000

Solution in C# (Mono 4.6.2.0) (judge verdict: Wrong Answer)

using System;
class AS
{
static void Main()
{
string st= Console.ReadLine();
int []a=new int[26];
string m="";
for(int i=0;i<st.Length;i++)
{
     m=st.Substring(i,1);
if(m=="q"){a[1]++;}
else if(m=="w"){a[0]++;}
else if(m=="e"){a[2]++;}
else if(m=="r"){a[3]++;}
else if(m=="t"){a[4]++;}
else if(m=="y"){a[5]++;}
else if(m=="u"){a[6]++;}
else if(m=="i"){a[7]++;}
else if(m=="o"){a[8]++;}
else if(m=="p"){a[25]++;}
else if(m=="a"){a[9]++;}
else if(m=="s"){a[10]++;}
else if(m=="d"){a[11]++;}
else if(m=="f"){a[12]++;}
else if(m=="g"){a[13]++;}
else if(m=="h"){a[14]++;}
else if(m=="j"){a[15]++;}
else if(m=="k"){a[16]++;}
else if(m=="l"){a[17]++;}
else if(m=="z"){a[18]++;}
else if(m=="x"){a[19]++;}
else if(m=="c"){a[20]++;}
else if(m=="v"){a[21]++;}
else if(m=="b"){a[22]++;}
else if(m=="n"){a[23]++;}
else if(m=="m"){a[24]++;}

}
int ans=0;
for(int i=0;i<26;i++){
if(a[i]%2==0){ans++;}
} if(ans==26){Console.WriteLine("Yes");
}else {Console.WriteLine("No");}
}
}