#include <bits/stdc++.h>
using namespace std;
int main() {
  int hr, mt;
  int h, d, c, n;
  scanf("%d%d", &hr, &mt);
  scanf("%d%d%d%d", &h, &d, &c, &n);
  int p = h + max((1200 - (hr * 60 + mt)) * d, 0), t;
  if (p % n != 0)
    t = p / n + 1;
  else
    t = p / n;
  double ans = t * c * 0.8;
  if (h % n != 0)
    t = h / n + 1;
  else
    t = h / n;
  ans = min(ans, t * c * 1.0);
  printf("%.3f\n", ans);
  return 0;
}
