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