#include <bits/stdc++.h>
using namespace std;
const int N = 100500;
int main() {
  srand(time(NULL));
  int h, m;
  int hp, dp, c, n;
  cin >> h >> m;
  cin >> hp >> dp >> c >> n;
  int mn = h * 60 + m;
  int hw = max(1200 - mn, 0);
  cout << fixed << setprecision(9);
  int t1 = (hw * dp + hp) / n;
  int t2 = (hp) / n;
  if ((hw * dp + hp) % n != 0) t1++;
  if ((hp) % n != 0) t2++;
  cout << min((t1 * 1.0 * (0.8 * c)), t2 * 1.0 * (c));
  return 0;
}
