#include <iostream>
#include<cstring>
#include<cstring>
#include<cmath>
#include<cstdio>
using namespace std;
char a[1005];
int main()
{
    int n,k,x,y,a;
    cin>>n>>k;
    if(n<k)
    {
      a=k*x;
    }
    else
        a=k*x+(n-k)*y;
    cout<<a<<endl;
    return 0;
}
