#include <bits/stdc++.h>
using namespace std;
const int INF = int(1e9);
const int MOD = int(1e9) + 7;
const long long N = 1000010;
const long long INFll = 1ll * INF * INF;
const long double ldINF = 1e+018;
const long double EPS = 0.000000001;
const int sdx[4] = {-1, 0, 1, 0};
const int sdy[4] = {0, 1, 0, -1};
const long double PI = 3.1415926535897932384;
template <typename T>
ostream& operator<<(ostream& out, pair<T, T>& a) {
  out << a.first << " " << a.second;
  return out;
}
template <typename T>
istream& operator>>(istream& in, pair<T, T>& a) {
  in >> a.first >> a.second;
  return in;
}
template <typename T>
istream& operator>>(istream& in, vector<T>& a) {
  for (int i = 0; i < a.size(); ++i) in >> a[i];
  return in;
}
template <typename T>
ostream& operator<<(ostream& out, vector<T> a) {
  for (int i = 0; i < a.size(); ++i)
    if (i == a.size() - 1)
      out << a[i];
    else
      out << a[i] << " ";
  return out;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long d, k, a, b, t;
  cin >> d >> k >> a >> b >> t;
  long long ans = INFll;
  long long l = 0, r = d / k;
  if (d % k != 0) r++;
  for (int it = 0; it < 100; it++) {
    long long m1 = l + (r - l) / 3;
    long long m2 = r - (r - l) / 3;
    if ((r - l) % 3 == 2) m1++;
    long long cur1 =
        a * min(d, m1 * k) + max(m1 - 1, 0ll) * t + max(d - m1 * k, 0ll) * b;
    long long cur2 =
        a * min(d, m2 * k) + max(m2 - 1, 0ll) * t + max(d - m2 * k, 0ll) * b;
    ans = min(ans, cur1);
    ans = min(ans, cur2);
    if (cur1 > cur2)
      l = m1;
    else
      r = m2;
  }
  cout << ans << endl;
  if (0)
    cerr << fixed << setprecision(0)
         << "TIME = " << clock() / (long double)CLOCKS_PER_SEC * 1000 << "\n";
  return 0;
}
