#include <bits/stdc++.h>
using namespace std;
const int N = 2000000 + 10;
int n, h, m, x, t, d, c;
vector<int> v;
int main() {
  scanf("%d%d%d%d%d%d", &h, &m, &t, &d, &c, &n);
  double need = (t + n - 1) / n * c;
  if (m != 0 && h < 20) {
    t += (60 - m) % 60 * d;
    h = (h + 1) % 24;
  }
  if (h < 20) {
    t += (60 * (20 - h)) * d;
  }
  double y = (t + n - 1) / n * (c * 0.8);
  printf("%0.5f\n", min(need, y));
  return 0;
}
