#include <bits/stdc++.h>
using namespace std;
int main() {
  long long d, k, a, b, t;
  cin >> d >> k >> a >> b >> t;
  if (k >= d) {
    cout << d * min(a, b);
    return 0;
  }
  long long arr[] = {
      d * a + (d / k - 1 + ((d % k) != 0)) * t, k * a + (d - k) * b,
      (d / k - (d % k == 0)) * k * a + (d / k - 1 + (d % k == 0)) * t +
          (d % k + (d % k == 0) * k) * b,
      d * b};
  cout << *min_element(arr, arr + 4);
  return 0;
}
