#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int d, k, a, b, t;
  cin >> d >> k >> a >> b >> t;
  if (k >= d) {
    cout << d * a;
    return 0;
  }
  long long int ans;
  ans = k * a;
  d -= k;
  long long int i, j, k2, m, n;
  i = d / k;
  j = i * k * a + i * t;
  k2 = d * b;
  m = (d - (k * i)) * b;
  n = (d - (k * i)) * a + t;
  if (m <= n)
    j += m;
  else
    j += n;
  if (k2 <= j) {
    cout << k2 + ans;
  } else
    cout << j + ans;
  return 0;
}
