#include <bits/stdc++.h>
using namespace std;
long long d, k, a, b, t;
long long cal(long long p) { return p * k * a + (p - 1) * t + (d - p * k) * b; }
int main() {
  scanf("%I64d%I64d%I64d%I64d%I64d", &d, &k, &a, &b, &t);
  {
    long long ans;
    if (d % k == 0)
      ans = (d / k - 1) * t + d * a;
    else
      ans = (d / k) * t + d * a;
    long long l = 1, r = d / k;
    while (l <= r) {
      if (r - l + 1 <= 10) {
        for (long long i = l; i <= r; i++) ans = min(ans, cal(i));
        break;
      }
      long long len = (r - l + 1) / 3;
      long long mid1 = l + len - 1, mid2 = r - len + 1;
      if (cal(mid1) < cal(mid2))
        r = mid2;
      else
        l = mid1;
    }
    printf("%I64d\n", ans);
  }
}
