#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e18;
const long long mod = 1000000007;
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long d, k, a, b, t;
  cin >> d >> k >> a >> b >> t;
  long long answ = 0;
  answ += k * a;
  if (k >= d) {
    cout << a * d;
    return 0;
  }
  if (t + a * k < b * k) {
    long long len = (d - k) / k * k;
    answ += len * a + len / k * t;
    if (len + k < d) {
      long long ost = d - k - len;
      if (t + a * ost < b * ost) {
        answ += t + a * ost;
      } else {
        answ += b * ost;
      }
    }
  } else {
    answ += (d - k) * b;
  }
  cout << answ;
  return 0;
}
