#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
void Open() {}
const int mod = 1000000007;
const int N = 100033;
int main() {
  long long d, k, a, b, t;
  scanf("%I64d%I64d%I64d%I64d%I64d", &d, &k, &a, &b, &t);
  long long ans = (long long)INF * INF;
  if (d <= k) {
    ans = a * d;
  } else {
    long long num = d / k;
    ans = min(a * k + b * (d - k),
              a * num * k + (d - num * k) * b + (num - 1) * t);
    ans = min(ans, a * num * k + num * t + a * (d - num * k));
  }
  printf("%I64d\n", ans);
  return 0;
}
