#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100000;
const long long INF = 1e15;
int main() {
  long long d, k, a, b, t;
  scanf("%I64d%I64d%I64d%I64d%I64d", &d, &k, &a, &b, &t);
  long long ans = 0;
  if (a < b) {
    if (d > k)
      ans += k * a, d -= k;
    else
      ans += d * a, d = 0;
  } else
    ans += d * b, d = 0;
  if (d > 0) {
    long long othr = d % k, car = d / k;
    if (car * (t + k * a) < car * k * b)
      ans += car * (t + k * a);
    else
      ans += car * k * b;
    if (othr * b < t + othr * a)
      ans += othr * b;
    else
      ans += t + othr * a;
  }
  printf("%I64d\n", ans);
  return 0;
}
