#include <bits/stdc++.h>
using ll = long long;
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  ll d, k, a, b, t;
  cin >> d >> k >> a >> b >> t;
  ll time = 0;
  ll pos = 0;
  if (b * k < a * k + t || k >= d) {
    pos = min(k, d);
    time = a * pos + (d - pos) * b;
  } else {
    pos = d - d % k;
    time = pos * a + t * (d / k - 1);
    time += min(b * (d - pos), t + a * (d - pos));
  }
  cout << time << endl;
  cout.flush();
  return 0;
}
