Đề:
Đề:
Đề:
#include <bits/stdc++.h>
using namespace std;
int n,m,a,b,tong;
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin>>n>>m>>a>>b;
if (n%m==0)
{
cout<<n/m*b;
return 0;
}
if (n<m)
{
cout<<n*a;
return 0;
}
while (n>m)
{
n=n-m;
tong=tong+m*b;
}
cout<<tong+n*a;
}