#include <bits/stdc++.h>
using namespace std;
int main() {
  int hh, mm;
  cin >> hh >> mm;
  int t = hh * 60 + mm;
  int H, D, C, N;
  cin >> H >> D >> C >> N;
  int R = H;
  double ret = 10000000000000000.0;
  double ans1 = 0.0, ans2 = 0.0;
  if (t < 20 * 60) {
    H = H + (20 * 60 - t) * D;
    ans1 = (((double)C * 80) / 100) * (double)((H + N - 1) / N);
    ans2 = ((double)C * (double)((R + N - 1) / N));
    ret = min(ans1, ans2);
  } else {
    ret = (((double)C * 80) / 100) * (double)((H + N - 1) / N);
  }
  cout << fixed << setprecision(4) << ret << endl;
  return 0;
}
