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