#include <bits/stdc++.h>
using namespace std;
long long d, k, a, b, t;
long long calc(long long x) {
  long long d1 = min(d, x * k);
  return x * t + d1 * a + (d - d1) * b;
}
int main() {
  cin >> d >> k >> a >> b >> t;
  if (k >= d) {
    cout << d * a << endl;
    return 0;
  }
  d -= k;
  long long l = 0, r = d, m1, m2, r1, r2, res = 2e18;
  while (l <= r) {
    m1 = (l + l + r) / 3;
    m2 = (l + r + r) / 3;
    r1 = calc(m1);
    r2 = calc(m2);
    res = min(res, min(r1, r2));
    if (r1 < r2)
      r = m2 - 1;
    else
      l = m1 + 1;
  }
  cout << res + k * a << endl;
  return 0;
}
