#include <bits/stdc++.h>
using namespace std;
long long a, b, d, k, t, ans;
inline long long f(long long m) {
  if (m == 0) return d * b;
  if (d < m * k) return d * a + (d / k) * t;
  return m * a * k + (m - 1LL) * t + (d - m * k) * b;
}
int main() {
  cin >> d >> k >> a >> b >> t;
  ans = min(min(min(f(1), f(d / k)), f(0)), f(d / k + 1LL));
  cout << ans << endl;
  return 0;
}
