#include <bits/stdc++.h>
using namespace std;
const long double pi = acos(-1);
const int n_ = 2e5 + 5;
long long d, k, a, b, t;
int main() {
  cin >> d >> k >> a >> b >> t;
  long long ans = min(k, d) * a;
  d -= min(k, d);
  long long ct = a * k + t;
  long long wt = b * k;
  long long x = d / k * min(ct, wt);
  ans += x;
  x = d % k;
  ans += min(x * a + t, x * b);
  cout << ans;
  return 0;
}
