#include <bits/stdc++.h>
using namespace std;
int main() {
  int hh, mm, h, d, c, n;
  cin >> hh >> mm;
  cin >> h >> d >> c >> n;
  float c1, c2;
  int s = h / n;
  if (n * s != h) {
    s++;
  }
  c1 = s * c;
  if (hh < 20) {
    hh = (19 - hh) * 60;
    mm = 60 - mm;
    int helper = h + d * (hh + mm);
    s = helper / n;
    if (n * s != helper) {
      s++;
    }
    c2 = c * s * 0.8;
  } else {
    c2 = c1 * 0.8;
  }
  if (c1 > c2) {
    c1 = c2;
  }
  cout << fixed << setprecision(4) << c1;
}
