#include <bits/stdc++.h>
using namespace std;
const long long N = 1e5 + 5;
int main() {
  long long dis, km, drive_time, walk_time, repair_time;
  scanf("%lld", &dis);
  ;
  scanf("%lld", &km);
  ;
  scanf("%lld", &drive_time);
  ;
  scanf("%lld", &walk_time);
  ;
  scanf("%lld", &repair_time);
  ;
  long long ans = 0;
  if (dis <= km) {
    if (drive_time * dis <= walk_time * dis) {
      ans = ans + drive_time * dis;
    } else {
      ans = ans + walk_time * dis;
    }
    cout << ans << "\n";
  } else {
    if (drive_time * km <= walk_time * km) {
      ans = ans + drive_time * km;
      dis = dis - km;
    } else {
      ans = ans + walk_time * km;
      dis = dis - km;
    }
    if (repair_time + drive_time * km < walk_time * km) {
      ans = ans + (dis / km) * (km * drive_time + repair_time);
      dis = dis % km;
    } else {
      ans = ans + (dis / km) * km * walk_time;
      dis = dis % km;
    }
    if (dis != 0 && repair_time + drive_time * dis < walk_time * dis) {
      ans = ans + repair_time + drive_time * dis;
    } else {
      ans = ans + walk_time * dis;
    }
    cout << ans << "\n";
  }
}
