#include <bits/stdc++.h>
using namespace std;
const int INF = 0x7f7f7f7f;
int main() {
  ios_base::sync_with_stdio(false);
  long long d, k, a, b, t;
  cin >> d >> k >> a >> b >> t;
  long long walk = b * k;
  long long car = a * k + t;
  long long time;
  if (d <= k)
    time = d * a;
  else if (car <= walk) {
    long long tmp = (d - k) / k;
    time = a * k + tmp * a * k + t * tmp;
    time += min((d % k) * a + t, (d % k) * b);
  } else
    time = a * k + b * (d - k);
  cout << time;
  cout << "\n";
  return 0;
}
