#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const int N = 1e5 + 9;
long long d, k, a, b, t;
int main() {
  cin >> d >> k >> a >> b >> t;
  double x = 1.0 * t / k + a;
  long long ans = 0, ans0 = 0;
  long long kk = k, dd = d;
  while (dd > 0 && kk > 0) ans0 += a, dd--, kk--;
  ans0 += dd * b;
  kk = k;
  while (d > 0 && kk > 0) ans += a, d--, kk--;
  long long n = d / k;
  ans += n * t + a * n * k;
  n = d % k;
  long long a1 = b * n;
  long long a2 = t + n * a;
  printf("%I64d\n", min(ans0, min(a1, a2) + ans));
  return 0;
}
