#include <bits/stdc++.h>
using namespace std;
int main() {
  long long d, k, a, b, t;
  long long ans = 0;
  cin >> d >> k >> a >> b >> t;
  if (d <= k) {
    ans = d * a;
    cout << ans << endl;
    return 0;
  }
  ans = k * a;
  d -= k;
  long long tpa, tpb;
  if (d <= k) {
    tpa = d * a + t;
    tpb = d * b;
    if (tpa < tpb)
      ans += tpa;
    else
      ans += tpb;
    printf("%I64d\n", ans);
    return 0;
  }
  tpa = k * a + t;
  tpb = k * b;
  if (tpa < tpb) {
    long long now = d / k;
    ans += tpa * now;
    d %= k;
    if (d == 0) {
      printf("%I64d\n", ans);
      return 0;
    }
  } else {
    ans += d * b;
    printf("%I64d\n", ans);
    return 0;
  }
  tpa = d * a + t;
  tpb = d * b;
  if (tpa < tpb)
    ans += tpa;
  else
    ans += tpb;
  printf("%I64d\n", ans);
  return 0;
}
