#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
long long d, k, a, b, t;
int main() {
  cin >> d >> k >> a >> b >> t;
  if (d <= k) {
    cout << a * d << endl;
    return 0;
  }
  d -= k;
  long long ans = a * k;
  if (d <= k) {
    if (a * d + t <= b * d)
      ans += a * d + t;
    else
      ans += b * d;
    cout << ans << endl;
    return 0;
  }
  if (a * k + t <= b * k) {
    long long x = d / k;
    ans += x * (a * k + t);
    d = d % k;
    if (a * d + t <= b * d)
      ans += a * d + t;
    else
      ans += b * d;
  } else
    ans += b * d;
  cout << ans << endl;
  return 0;
}
