#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 12, INF = 1e9 + 7;
int a[N], b[N];
int main() {
  double hh, mm, h, d, c, n, ans = INF;
  cin >> hh >> mm >> h >> d >> c >> n;
  double x = hh * 60 + mm;
  ans = (int((h + (n - 1)) / n)) * c;
  x -= 20.0 * 60.0;
  if (x < 0) {
    h += abs(x) * d;
  }
  c /= 100;
  c *= 80;
  ans = min((int((h + (n - 1)) / n)) * c, ans);
  cout << fixed << setprecision(5) << ans;
}
