#include <bits/stdc++.h>
using namespace std;
long long int cube[30];
int main() {
  ios_base ::sync_with_stdio(0);
  cin.tie(0);
  for (int j = 1; j < 30; j++) cube[j] = j * j * j;
  long long int d, k, a, b, t;
  cin >> d >> k >> a >> b >> t;
  long long int ans = 0;
  long long int x = a * k + t;
  if (d <= k)
    cout << a * d << endl;
  else if (x <= b * k) {
    long long int rep = d / k - (d % k == 0 ? 1 : 0) - 1;
    long long int rem = d % k, ans = rep * t + (rep + 1) * a * k;
    if (rem == 0) rem = k;
    if (rem * b <= (t + a * rem))
      ans += rem * b;
    else
      ans += t + a * rem;
    cout << ans << endl;
  } else {
    if (d <= k)
      cout << d * a << endl;
    else
      cout << (a * k + (d - k) * b) << endl;
  }
  return 0;
}
