#include <cstdio> int main() { int N, A, X, Y, hasil, hasil2, hasil3; scanf("%d %d %d %d",&N,&A,&X,&Y); if (A < N) { hasil2 = N - A; hasil3 = A * X; hasil = hasil2 + hasil3 * Y; printf("%d", hasil); } else { hasil = A * X; printf("%d", hasil); }}
5 3 20 15
902
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!