#include <bits/stdc++.h>
using namespace std;
long long d, k, a, b, t, x, y;
int main() {
  cin >> d >> k >> a >> b >> t;
  x = d % k == 0 ? (d / k - 1) * (a * k + t) + a * k
                 : d / k * (a * k + t) + a * (d % k),
  y = a * k + t >= k * b ? d <= k ? a * k : a * k + (d - k) * b
      : d % k == 0       ? (d / k - 1) * (a * k + t) + a * k
      : d <= k           ? a * d
                         : (d / k - 1) * (a * k + t) + a * k + (d % k) * b;
  return printf("%lld\n", min(x, y)), 0;
}
