#include <bits/stdc++.h>
using namespace std;
long long d, k, a, b, t;
long long f(long long x) {
  return x * t + min(d, (x + 1) * k) * a + max(0ll, d - (x + 1) * k) * b;
}
int main() {
  cin >> d >> k >> a >> b >> t;
  long long l = 0, r = d / k + 10;
  while (r - l >= 3) {
    long long m1 = l + (r - l) / 3;
    long long m2 = r - (r - l) / 3;
    if (f(m1) < f(m2))
      r = m2;
    else
      l = m1;
  }
  long long ans = l;
  while (l <= r) {
    if (f(l) < f(ans)) ans = l;
    l++;
  }
  cout << f(ans) << endl;
  return 0;
}
