#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
ll solve(ll d, ll k, ll a, ll b, ll t) {
  if (d <= k) return a * d;
  d -= k;
  auto time = a * k;
  auto s = static_cast<ld>(t) / (b - a);
  if (k * (b - a) <= t) return time + b * d;
  if (t >= d * (b - a)) return time + b * d;
  auto x_estimate = (d - s) / k + 1;
  auto x = static_cast<ll>(x_estimate) - 5;
  while ((d - x * k) * (b - a) > t) x++;
  assert(x >= 1);
  if (x * k <= d) {
    d -= x * k;
    time += x * t + a * x * k;
    time += b * d;
  } else {
    x--;
    d -= x * k;
    time += x * t + a * x * k;
    time += t;
    time += a * d;
  }
  return time;
}
int main() {
  ll d;
  int k, a, b, t;
  cin >> d >> k >> a >> b >> t;
  cout << solve(d, k, a, b, t) << endl;
}
