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