#include <bits/stdc++.h>
using namespace std;
long long d, ans;
long long k, a, b, t;
int main() {
  cin >> d >> k >> a >> b >> t;
  int i, j, s, p, q;
  long long now, dt = min((long long)k, d);
  ans = dt * a + (d - dt) * b;
  long long m = d / k;
  if (d < k) {
    printf("%I64d\n", ans);
    return 0;
  }
  now = (long long)a * (long long)k * (long long)m + (m - 1) * t;
  long long nw;
  if (d % k != 0) {
    nw = now + (d - m * k) * a + t;
    if (ans > nw) ans = nw;
    nw = now + (d - m * k) * b;
    if (ans > nw) ans = nw;
  } else {
    if (ans > now) ans = now;
  }
  cout << ans << endl;
  return 0;
}
