#include <bits/stdc++.h>
using namespace std;
int main(void) {
  ios_base::sync_with_stdio(false);
  long long d, k, a, b, t;
  cin >> d >> k >> a >> b >> t;
  if (k >= d) {
    cout << a * d << endl;
    return 0;
  }
  long long ta = k * a + (d - k) * b;
  long long tb, tc;
  if (d % k == 0) {
    tb = (d / k - 1) * k * a + (d / k - 2) * t + d * b;
    tc = (d / k) * k * a + (d / k - 1) * t;
  } else {
    tb = (d / k) * k * a + (d / k - 1) * t + (d % k) * b;
    tc = (d / k) * k * a + (d / k) * t + (d % k) * a;
  }
  cout << min(ta, min(tb, tc)) << endl;
  return 0;
}
