#include <bits/stdc++.h>
using namespace std;
int main()
{
int n,m,a,b;
cin>>n>>m>>a>>b;
int final=0,dp[n+1];
dp[0]=0;
for(int i=1;i<=n;i++){
if(i>=m)
dp[i] = min(dp[i-1]+a,dp[i-m]+b);
else dp[i]=min(dp[i-1]+a,b);
//cout<<dp[i]<<" ";
}
cout<<dp[n];
return 0;
}
ICAjaW5jbHVkZSA8Yml0cy9zdGRjKysuaD4KICB1c2luZyBuYW1lc3BhY2Ugc3RkOwogIGludCBtYWluKCkgCiAgewogICAgICBpbnQgbixtLGEsYjsgCiAgICAgIGNpbj4+bj4+bT4+YT4+YjsKICAgICAgaW50IGZpbmFsPTAsZHBbbisxXTsKICAgICAgZHBbMF09MDsKICAgICAgZm9yKGludCBpPTE7aTw9bjtpKyspewogICAgICAJaWYoaT49bSkgCiAJCQlkcFtpXSA9IG1pbihkcFtpLTFdK2EsZHBbaS1tXStiKTsKCQllbHNlIGRwW2ldPW1pbihkcFtpLTFdK2EsYik7CgkJLy9jb3V0PDxkcFtpXTw8IiAiOyAgCiAgICAgIH0KICAgICAgY291dDw8ZHBbbl07CiAgICAgIHJldHVybiAwOwogfQ==