#include <bits/stdc++.h>
using namespace std;
long long d, k, a, b, t;
inline void solve() {
  cin >> d >> k >> a >> b >> t;
  if (d < k) {
    cout << a * d << '\n';
    return;
  }
  long long c1 = d * a + t * (long long)(d / k);
  long long c2 = k * a + b * (d - k);
  long long c3 = (d % k) * b + t * ((long long)(d / k) - 1) + a * (d - d % k);
  cout << min(c1, min(c2, c3)) << '\n';
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0), cout.tie(0);
  int T = 1;
  for (; T--;) solve();
}
