#include <bits/stdc++.h>
using namespace std;
int main() {
  long long d;
  int k, a, b, t;
  while (cin >> d >> k >> a >> b >> t) {
    long long answer = min(d, 0LL + k) * a + (d - min(d, 0LL + k)) * b;
    for (long long x = max(0LL, d / k - 1); x <= d / k + 1; ++x) {
      answer = min(answer, min(d, 1LL * x * k) * a + max(0LL, d - x * k) * b +
                               max(0LL, (x - 1)) * t);
    }
    cout << answer << endl;
  }
  return 0;
}
