#include <bits/stdc++.h>
using namespace std;
void __dbg() { cout << endl; }
template <typename Arg, typename... Args>
void __dbg(Arg A, Args... B) {
  cout << ' ' << A;
  __dbg(B...);
}
const int inf = INT_MAX;
const int ninf = INT_MIN;
const int mod = 1e9 + 7;
const int maxN = 1e6 + 2;
int main() {
  long long d, k, a, b, t;
  cin >> d >> k >> a >> b >> t;
  long long alpha = d / k;
  long long dist = k * alpha;
  long long last_seg = d - dist;
  long long ret = min(dist * a + (max(0LL, (alpha - 1)) * t), dist * b);
  if (t + (last_seg * a) < last_seg * b) {
    ret += t + (last_seg * a);
  } else {
    ret += (last_seg * b);
  }
  long long another = min(k, d) * a + max(0LL, d - k) * b;
  ret = min(ret, another);
  printf("%lld\n", ret);
  return 0;
}
