# Pastebin uDpP9J6s ''' -------------------------------------------------- John is travelling by train. The fare depends on the kilometers traveled. For the first A kilometers, the fare is M. For the subsequent distance, it's N per kilometer. The total distance covered by train is D. Find out the total fare. -------------------------------------------------- INPUT Four space separated integers A,M,N,D. -------------------------------------------------- OUTPUT Print the value of total fare. -------------------------------------------------- CONSTRAINTS 1<=A,M,N,D<=1000 -------------------------------------------------- SAMPLE INPUT 1 2 3 5 -------------------------------------------------- SAMPLE OUTPUT 14 -------------------------------------------------- ''' A,M,N,D = [int(x) for x in input().split(' ')] print(A*M+N*(D-A))