#include <bits/stdc++.h>
using namespace std;
long long d, k, a, b, t;
int main() {
  scanf("%lld %lld %lld %lld %lld", &d, &k, &a, &b, &t);
  long long t1 = k * a + t, t2 = k * b;
  long long ans = 0;
  if (t2 <= t1) {
    if (d <= k)
      ans = d * a;
    else {
      ans = k * a + (d - k) * b;
    }
  } else {
    long long cnt = d / k;
    long long remain = d % k;
    if (d <= k)
      ans = d * a;
    else {
      ans = (cnt - 1) * (k * a + t) + k * a + remain * b;
      if (remain == 0) cnt--, remain = k;
      ans = min(ans, cnt * (k * a + t) + a * remain);
    }
  }
  printf("%lld\n", ans);
  return 0;
}
