https://codeforces.com/problemset/problem/466/A
#include<bits/stdc++.h>
using namespace std;
typedef long long int LL;
int main(void)
{
LL n,m,a,b; cin>>n>>m>>a>>b;
LL ans=1e9;
for(int i=0;i<=n;i++)
{
for(int j=0;j<=n;j++)
{
if(i+j*m>=n)
{
LL temp=a*i+j*b;
ans=min(ans,temp);
}
}
}
cout<<ans;
return 0;
}