#include <bits/stdc++.h>
const double eps = 1e-8;
const int MAXN = (int)1e9 + 5;
using namespace std;
int main(int argc, char const *argv[]) {
  long long a, b, d, k, t;
  while (~scanf("%lld%lld%lld%lld%lld", &d, &k, &a, &b, &t)) {
    long long sum;
    if (k >= d) {
      sum = d * a;
    } else {
      if (a * k + t < b * k) {
        sum = (d / k) * k * a + t * (d / k - 1) +
              min((d % k) * a + t, (d % k) * b);
      } else {
        sum = a * k + b * (d - k);
      }
    }
    printf("%lld\n", sum);
  }
  return 0;
}
