a = int(input()) #стоимость тарифа
b = int(input()) #размер тарифа
c = int(input()) #стоимость каждого лишнего мегабайта
d = int(input()) #размер интернет-трафика Кости в следующем месяце
if (d > b):
print(a + c * (d - b))
else:
print(a)
To embed this project on your website, copy the following code and paste it into your website's HTML: