text: /**
   *    @author     : Maruf Tuhin
   *    @School     : CUET CSE 11
   *    @Topcoder   : the_redback
   *    @CodeForces : the_redback
   *    @UVA        : the_redback
   *    @link       : http://www.fb.com/maruf.2hin
   */
  
  #include <bits/stdc++.h>
  
  using namespace std;
  
  typedef long long          ll;
  typedef unsigned long long llu;
  
  #define ft        first
  #define sd        second
  #define mp        make_pair
  #define pb(x)     push_back(x)
  #define all(x)    x.begin(),x.end()
  #define allr(x)   x.rbegin(),x.rend()
  #define mem(a,b)  memset(a,b,sizeof(a))
  #define meminf(a) memset(a,126,sizeof(a))
  #define inf       1e11
  #define eps       1e-9
  #define mod       1000000007
  #define NN        5000
  
  //cout << setfill('0') << setw(3) << a << endl;
  //cout << fixed << setprecision(20) << a << endl;
  
  
  main()
  {
      ios_base::sync_with_stdio(0); cin.tie(0);
      int t=1,tc;
      ll i,j,k,l,m,n;
      ll a,b;
      cin>>n>>m>>a>>b;
      ll temp=min(b,a*m);
      ll res=n/m;
      ll ans=res*temp;
      ans+=min((n-(res*m))*a,b);
      cout<<ans<<"\n";
  
      return 0;
  }
  