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