#include <bits/stdc++.h>
using namespace std;
int main() {
  long long d;
  long long k, a, b, t;
  while (cin >> d >> k >> a >> b >> t) {
    long long res = d / k;
    int mod = d % k;
    if (res == 0)
      cout << d * a << endl;
    else {
      if (mod == 0) {
        long long t1 = a * k + (d - k) * b;
        long long t2 = a * d + t * (res - 1);
        cout << min(t1, t2) << endl;
      } else {
        long long t1 = a * k + (d - k) * b;
        long long t2 = a * (res * k) + t * (res - 1) + mod * b;
        long long t3 = d * a + res * t;
        cout << min(min(t1, t2), t3) << endl;
      }
    }
  }
  return 0;
}
