#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int d, k, a, b, t;
  cin >> d >> k >> a >> b >> t;
  long long int ans, intervals;
  if (d <= k)
    ans = d * a;
  else {
    if (k * a + t <= k * b) {
      intervals = d / k - 1;
      ans = intervals * t + intervals * k * a + k * a +
            min((d % k) * a + t, (d % k) * b);
    } else {
      ans = min(d, k) * a;
      d = d - min(d, k);
      ans += d * b;
    }
  }
  cout << ans;
  return 0;
}
