#include <bits/stdc++.h>
using namespace std;
long long d, k, a, b, t;
void solve() {
  cin >> d >> k >> a >> b >> t;
  if (d <= k) {
    cout << d * a;
    return;
  }
  long long ans = k * a + d * b - k * b;
  long long mult = t + k * a - k * b;
  if (mult >= 0) {
    cerr << 1 << '\n';
    cout << ans;
  } else {
    mult = abs(mult);
    long long low = 0;
    long long high = d / k - 1;
    long long n = ans / mult;
    long long ans2 =
        min(d * b, d * a + (long long)ceil(((double)d) / k - 1) * t);
    if (n >= low && n <= high) {
      cout << min(ans2, ans - n * mult);
    } else if (n > high) {
      cout << min(ans2, ans - high * mult);
    } else
      cout << min(ans2, ans);
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  solve();
  return 0;
}
