#include <bits/stdc++.h>
using namespace std;
long long OO = LONG_MAX, M = 1e9 + 7;
const double pi = acos(-1);
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long d, k, a, b, t;
  cin >> d >> k >> a >> b >> t;
  if (k > d) return cout << a * d, 0;
  long long time = a * k;
  d -= k;
  long long rem = d % k;
  time += min(rem * b, t + rem * a);
  d -= rem;
  time += min(d / k * t + a * d, b * d);
  cout << time;
  return 0;
}
