#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long d, k, a, b, t, nd, sol;
  cin >> d >> k >> a >> b >> t;
  sol = a * min(k, d);
  d -= min(k, d);
  nd = d / k;
  d -= nd * k;
  sol += min(b * nd * k, a * nd * k + t * nd) + min(b * d, a * d + t);
  cout << sol;
  return 0;
}
