#include <bits/stdc++.h>
using namespace std;
int main() {
  long long d, k, tc, tf, tr, res = 100 * 100 * 100 * 100LL;
  scanf("%lld", &d);
  ;
  scanf("%lld", &k);
  ;
  scanf("%lld", &tc);
  ;
  scanf("%lld", &tf);
  ;
  scanf("%lld", &tr);
  ;
  if (k >= d) return 0 * printf("%lld", d * tc);
  if (k * tc + tr >= k * tf) return 0 * printf("%lld", k * tc + (d - k) * tf);
  long long chk = d / k;
  long long bach_gya = d % k;
  printf("%lld", tr * (chk - 1) + tc * chk * k +
                     min(bach_gya * tc + tr, bach_gya * tf));
}
