#include <bits/stdc++.h>
using namespace std;
const int N = 270021;
inline int scan() {
  char c = getchar();
  int x = 0;
  while (c < '0' || c > '9') {
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    x = (x << 1) + (x << 3) + c - '0';
    c = getchar();
  }
  return x;
}
long long int add(long long int a, long long int b) {
  return a + b - (a + b >= 1000000007) * 1000000007;
}
long long int sub(long long int a, long long int b) {
  return a - b + (a - b < 0) * 1000000007;
}
long long int mult(long long int a, long long int b) {
  return (1LL * a * b) % 1000000007;
}
inline long long int gcd(long long int a, long long int b) {
  long long int t;
  while (b) {
    a = a % b;
    t = a;
    a = b;
    b = t;
  }
  return a;
}
long long int exponentmod(long long int a, long long int b) {
  long long int res = 1;
  a %= 1000000007;
  assert(b >= 0);
  for (; b; b >>= 1) {
    if (b & 1) res = res * a % 1000000007;
    a = a * a % 1000000007;
  }
  return res;
}
int bin_1(long long int x) {
  int r = 0;
  while (x) {
    r++;
    x &= x - 1;
  }
  return r;
}
long long int modpow(long long int b, long long int e, long long int m) {
  long long int r = 1;
  b = b % m;
  while (e > 0) {
    if (e % 2 == 1) r = (r * b) % m;
    e /= 2;
    b = (b * b) % m;
  }
  return r;
}
long long int modinverse(long long int a) {
  return modpow(a, 1000000007 - 2, 1000000007);
}
long long int nCrmod(long long int n, long long int r, long long int m) {
  if (r > n) r = n - r;
  long long int res = 1;
  for (long long int i = r; i >= 1; i--) {
    res = (res * (n - i + 1)) % m;
    res = (res * modinverse(i));
  }
  return res;
}
long long int power(long long int b, long long int e) {
  if (e == 0) return 1;
  if (e % 2 == 0) return power(b * b, e / 2);
  return b * power(b * b, e / 2);
}
double powerf(double b, int e) {
  if (e == 0) return 1;
  if (e % 2 == 0)
    return powerf(b * b, e / 2);
  else {
    if (e > 0)
      return b * powerf(b * b, e / 2);
    else
      return powerf(b * b, e / 2) / b;
  }
}
const int sievesize = (long long int)1e6 + 10;
bool prime[sievesize + 1];
void sieve() {
  long long int x, y;
  prime[0] = prime[1] = true;
  for (x = 2; x * x <= sievesize; x++) {
    if (!prime[x])
      for (y = x * x; y <= sievesize; y += x) prime[y] = true;
  }
}
long long int nextPowerOf2(long long int n) {
  n--;
  n |= n >> 1;
  n |= n >> 2;
  n |= n >> 4;
  n |= n >> 8;
  n |= n >> 16;
  n++;
  return n;
}
bool isPerfectSquare(long long int n) {
  if (n < 0) return false;
  long long int tst = (long long int)(sqrt(n) + 0.5);
  return tst * tst == n;
}
bool triangle(long long int a, long long int b, long long int c) {
  return ((a + b) > c && (b + c) > a && (a + c) > b);
}
long long int chartoint(char c) {
  switch (c) {
    case '1':
      return 1;
      break;
    case '2':
      return 2;
      break;
    case '3':
      return 3;
      break;
    case '4':
      return 4;
      break;
    case '5':
      return 5;
      break;
    case '6':
      return 6;
      break;
    case '7':
      return 7;
      break;
    case '8':
      return 8;
      break;
    case '9':
      return 9;
      break;
    default:
      return 0;
      break;
  }
}
long long int d, k, a, b, t;
long long int solve(long long int cd) {
  long long int wd = d - cd;
  long long int res = wd * b;
  res += cd * a + (cd - 1) / k * t;
  return res;
}
int main() {
  cin >> d >> k >> a >> b >> t;
  if (b >= a + t || k >= d) {
    cout << solve(d) << endl;
    return 0;
  }
  long long int res = solve(k);
  for (long long int i = 0; i <= k; ++i) res = min(res, solve(d - i));
  cout << res << endl;
  return 0;
}
