#include <bits/stdc++.h>
using namespace std;
int main() {
  uint64_t d, k, a, b, t, c = 0;
  cin >> d >> k >> a >> b >> t;
  if (d <= k)
    c = a * d;
  else if (b * k < t + a * k) {
    c = a * k + b * (d - k);
  } else {
    c = a * k;
    d -= k;
    c += (t + a * k) * (d / k);
    d %= k;
    c += min(b * d, t + a * d);
  }
  cout << c << '\n';
  return 0;
}
