#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool read(T &x) {
  int c = getchar();
  int sgn = 1;
  while (~c && c<'0' | c> '9') {
    if (c == '-') sgn = -1;
    c = getchar();
  }
  for (x = 0; ~c && '0' <= c && c <= '9'; c = getchar()) x = x * 10 + c - '0';
  x *= sgn;
  return ~c;
}
const long long N = 200005;
int main() {
  long long d = ({
    long long a;
    read(a);
    a;
  }),
            k = ({
              long long a;
              read(a);
              a;
            }),
            a = ({
              long long a;
              read(a);
              a;
            }),
            b = ({
              long long a;
              read(a);
              a;
            }),
            t = ({
              long long a;
              read(a);
              a;
            });
  long long x = d / k;
  long long ex = d - x * k;
  if (!x) return printf("%I64d", d * a), 0;
  long long car = x * k * a + t * (x - 1);
  long long walk = x * k * b;
  long long m, m1, m2, m3;
  m = walk + ex * b;
  if (ex) {
    m1 = car + t;
    m1 += ex * a;
  } else {
    m1 = car;
  }
  m2 = car + ex * b;
  m3 = k * a + (d - k) * b;
  cout << min(m3, min(m, min(m1, m2)));
}
