#include <bits/stdc++.h>
using namespace std;
template <typename t>
t in(t q) {
  cin >> q;
  return q;
}
template <typename T>
ostream& operator<<(ostream& os, const vector<T>& v) {
  os << "[";
  for (int i = 0; i < ((int)size(v)); ++i) {
    os << v[i];
    if (i != ((int)size(v)) - 1) os << ",";
  }
  os << "]";
  return os;
}
template <typename T, typename S>
ostream& operator<<(ostream& os, const map<T, S>& v) {
  for (auto it : v) os << "(" << it.first << ":" << it.second << ")";
  return os;
}
template <typename T, typename S>
ostream& operator<<(ostream& os, const pair<T, S>& v) {
  os << "(" << v.first << "," << v.second << ")";
  return os;
}
const long double PI = acosl(-1);
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cout << setprecision(10);
  long long d, k, a, b, t;
  cin >> d >> k >> a >> b >> t;
  if (d <= k)
    cout << a * d;
  else if (a * k + t - b * k >= 0) {
    cout << a * k + b * (max(0ll, d - k));
  } else {
    long long x = d / k;
    if (x * k != d) {
      cout << min(a * x * k + t * max(x - 1, 0ll) + b * max(d - x * k, 0ll),
                  a * d + t * x);
    } else {
      cout << a * x * k + t * max(x - 1, 0ll);
    }
  }
  return 0;
}
