#include <bits/stdc++.h>
using namespace std;
long long d, k, a, b, t;
long long calc(long long num) {
  long long all = d, used = 0;
  all -= num * k;
  used += num * (k * a + t);
  long long car = min(k, all);
  used += a * car;
  all -= car;
  return used + all * b;
}
int main() {
  cin >> d >> k >> a >> b >> t;
  long long ans = calc(0);
  ans = min(ans, min(calc(d / k), calc(max(d / k - 1, 0ll))));
  cout << ans << endl;
  return 0;
}
