#include <bits/stdc++.h>
using namespace std;
map<long long, long long> mp;
int n, m;
const int nax = 2e6 + 6;
long long a[nax], b[nax];
int main() {
  long long d, k, a, b, t;
  cin >> d >> k >> a >> b >> t;
  if (d <= k)
    cout << a * d << endl;
  else {
    if (a * k + t > b * k) {
      cout << a * k + (d - k) * b << endl;
    } else {
      long long number = d / k;
      long long rem = d % k;
      cout << number * k * a + (number - 1) * t + min(t + rem * a, rem * b)
           << endl;
    }
  }
  return 0;
}
