#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int i, j, d, k, a, b, t, ans, curr;
  scanf("%lld %lld %lld %lld %lld", &d, &k, &a, &b, &t);
  if (d <= k) {
    ans = d * a;
  } else {
    ans = k * a;
    d -= k;
    ans += (d / k) * (min(t + a * k, b * k));
    d -= (d / k) * k;
    ans += min(t + a * d, b * d);
  }
  cout << ans;
  return 0;
}
