#include <bits/stdc++.h>
typedef long long LL;
using namespace std;
const int M = 1000000007;
int main() {
  ios_base::sync_with_stdio(0);
  cout.precision(15);
  cout.setf(ios::fixed);
  LL d, k, a, b, t;
  cin >> d >> k >> a >> b >> t;
  if (d <= k) {
    cout << (d * a) << '\n';
    return 0;
  }
  d -= k;
  LL ans = k * a;
  LL dk = d / k;
  if ((k * a) + t < (k * b)) {
    d -= (dk * k);
    ans += (((k * a) + t) * dk);
  } else {
    ans += d * b;
    d = 0;
  }
  ans += min(t + (a * d), b * d);
  cout << ans << '\n';
}
