#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9 + 7;
const long long llinf = 1e18 + 7;
const double eps = 1e-15;
long long d, k, a, b, t;
long long cost(long long d) {
  if (d == 0) return 0;
  return ((d + k - 1) / k - 1) * t + d * a;
}
int main() {
  cin >> d >> k >> a >> b >> t;
  long long ans = d * b;
  ans = min(ans, cost(d));
  if (d >= k) ans = min(ans, cost(k) + (d - k) * b);
  ans = min(ans, cost((d / k) * k) + (d - (d / k) * k) * b);
  cout << ans << endl;
  return 0;
}
