#include <bits/stdc++.h>
using namespace std;
long long read() {
  long long a = 0, b = getchar(), c = 1;
  while (!isdigit(b)) c = b == '-' ? -1 : 1, b = getchar();
  while (isdigit(b)) a = a * 10 + b - '0', b = getchar();
  return a * c;
}
long long d, k, a, b, t, x, y, z, ans;
int main() {
  d = read(), k = read(), a = read(), b = read(), t = read();
  x = d * a, y = d - k, z = k * a;
  if (d <= k)
    ans = x;
  else
    ans = z + y / k * min(z + t, k * b) + min(y % k * a + t, y % k * b);
  cout << ans;
  return 0;
}
