Problem: After waking up at hh:mm, Andrew realised that he had forgotten to feed his only cat for yet another time (guess why there's only one cat). The cat's current hunger level is H points, moreover each minute without food increases his hunger by D points.

At any time Andrew can visit the store where tasty buns are sold (you can assume that is doesn't take time to get to the store and back). One such bun costs C roubles and decreases hunger by N points. Since the demand for bakery drops heavily in the evening, there is a special 20% discount for buns starting from 20:00 (note that the cost might become rational). Of course, buns cannot be sold by parts.

Determine the minimum amount of money Andrew has to spend in order to feed his cat. The cat is considered fed if its hunger level is less than or equal to zero.

Input

The first line contains two integers hh and mm (00 ≤ hh ≤ 23, 00 ≤ mm ≤ 59) — the time of Andrew's awakening.

The second line contains four integers H, D, C and N (1 ≤ H ≤ 105, 1 ≤ D, C, N ≤ 102).

Output

Output the minimum amount of money to within three decimal digits. You answer is considered correct, if its absolute or relative error does not exceed 10 - 4.

Formally, let your answer be a, and the jury's answer be b. Your answer is considered correct if <image>.

Examples

Input

19 00
255 1 100 1


Output

25200.0000


Input

17 41
1000 6 15 11


Output

1365.0000

Note

In the first sample Andrew can visit the store at exactly 20:00. The cat's hunger will be equal to 315, hence it will be necessary to purchase 315 buns. The discount makes the final answer 25200 roubles.

In the second sample it's optimal to visit the store right after he wakes up. Then he'll have to buy 91 bins per 15 roubles each and spend a total of 1365 roubles.

Solution (in JAVA):

Solution:
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.StringTokenizer;
import java.util.stream.IntStream;

public class Main {
    final static long MOD = 1000000007;
    public static void main(String[] args) {
        FastScanner fs = new FastScanner();
        PrintWriter out = new PrintWriter(System.out);
        int hh = fs.nextInt();
        int mm = fs.nextInt();
        int h = fs.nextInt();
        int d = fs.nextInt();
        int c = fs.nextInt();
        int n = fs.nextInt();

        if(hh < 20) {
            double mituesto8 = (60 * (19 - hh) + (60 - mm));

            //System.out.println(mituesto8);

            double pointsat8 = h + d * (mituesto8);

            double costat8 = Math.ceil(pointsat8 / n);

            double dcost = costat8 - (costat8 / 5);

            double costwhenwake = h;

            double costw = Math.ceil(h/(n*1.0));
            //System.out.println(costw+" "+costw*c+" "+dcost*c);
            out.println(Math.min(costw*c,dcost*c));

        }

        else {
            double costwhenwake = h;

            double costw = Math.ceil(h/(n*1.0));

            costw = costw*c;
            double dcost = costw - (costw/5);

            out.println(dcost);
        }

        out.flush();
        out.close();

    }

    static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner() {
            try {
                br = new BufferedReader(new InputStreamReader(System.in));
                //br = new BufferedReader(new FileReader("prodan.json"));
                st = new StringTokenizer("");
            } catch (Exception e) {
                e.printStackTrace();
            }
        }

        public String next() {
            if (st.hasMoreTokens())
                return st.nextToken();
            try {
                st = new StringTokenizer(br.readLine());
            } catch (Exception e) {
                e.printStackTrace();
            }
            return st.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

        public double nextDouble() {
            return Double.parseDouble(next());
        }

        public String nextLine() {
            String line = "";
            try {
                line = br.readLine();
            } catch (Exception e) {
                e.printStackTrace();
            }
            return line;
        }

        public Integer[] nextIntegerArray(int n) {
            Integer[] a = new Integer[n];
            for (int i = 0; i < n; i++)
                a[i] = nextInt();
            return a;
        }

        public int[] nextIntArray(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = nextInt();
            return a;
        }

        public long[] nextLongArray(int n) {
            long[] a = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = nextLong();
            return a;
        }

        public char[] nextCharArray() {
            return nextLine().toCharArray();
        }
    }


}

class SegmentTree {
    int MAX;
    Node[] nodes;
    SegmentTree(int a[], int n) {
        int x = (int) (Math.ceil(Math.log(n) / Math.log(2)));
        int MAX = 2 * (int) Math.pow(2, x) - 1;
        nodes = new Node[MAX];
        for(int i = 0; i < MAX; i++) {
            nodes[i] = new Node();
        }
        constructSegmentTreeUtil(a, 0, n - 1, 0);
    }

    public void constructSegmentTreeUtil(int a[], int start, int end, int index) {
        if(start > end)
            return;
        if(start == end) {
            nodes[index].top50.add(new Pair(start, a[start]));
            return;
        }
        int mid = (start+end)/2;
        constructSegmentTreeUtil(a, start, mid, index*2+1);
        constructSegmentTreeUtil(a, mid+1, end, index*2+2);
        nodes[index].top50 = merge(nodes[index*2+1].top50 , nodes[index*2+2].top50);
    }

    private ArrayList<Pair> merge(ArrayList<Pair> left, ArrayList<Pair> right) {
        ArrayList<Pair> tobeReturned = new ArrayList<>();
        int leftIndex = 0;
        int rightIndex = 0;
        while(leftIndex < left.size() && rightIndex < right.size()) {
            if(left.get(leftIndex).value > right.get(rightIndex).value) {
                tobeReturned.add(left.get(leftIndex++));
            } else {
                tobeReturned.add(right.get(rightIndex++));
            }
        }
        tobeReturned.addAll(left.subList(leftIndex, left.size()));
        tobeReturned.addAll(right.subList(rightIndex, right.size()));
        return new ArrayList<Pair> (tobeReturned.subList(0,  tobeReturned.size() < 50 ? tobeReturned.size() : 50));
    }

    public void update(int n, int index, int value) {
        updateUtility(0, 0, n-1, index, value);
    }

    public void updateUtility(int currentIndex, int start, int end, int index, int value) {
        if(start > index || end < index)
            return;


        for(int i = 0; i < nodes[currentIndex].top50.size(); i++) {
            if(nodes[currentIndex].top50.get(i).index == index) {
                nodes[currentIndex].top50.remove(i);
                break;
            }
        }
        nodes[currentIndex].top50 = merge(nodes[currentIndex].top50, new ArrayList<Pair>(Arrays.asList(new Pair(index, value))));

        if(start != end) {
            int mid = (start + end) / 2;
            updateUtility((currentIndex * 2 )+ 1, start, mid, index, value);
            updateUtility((currentIndex * 2) + 2, mid + 1, end, index, value);
        }

    }


    private ArrayList<Pair> queryUtility(int start, int end, int qstart, int qend,int index) {
        if (start > end || start > qend || end < qstart)
            return new ArrayList<>();
        if(start >= qstart && end <= qend) {
            return nodes[index].top50;
        }

        int mid = (start+end)/2;
        return merge(queryUtility(start, mid, qstart, qend, 2*index+1), queryUtility(mid+1, end, qstart, qend, 2*index+2));
    }

    public long query(int n, int start, int end) {
        ArrayList<Pair> arl = queryUtility(0, n-1, start, end, 0);
        long answer = 0;
        for (int i = 0; i <= arl.size()-3; i++) {
            if ((long)arl.get(i).value < (long)arl.get(i+1).value + arl.get(i+2).value) {
                answer = (long) arl.get(i).value + arl.get(i + 1).value + arl.get(i + 2).value;
                break;
            }
        }
        return answer;
    }
}

class Node{
    @Override
    public String toString() {
        return "Node{" +
                "top50=" + top50 +
                '}';
    }

    ArrayList<Pair> top50;
    Node(){
        top50 = new ArrayList<>();
    }
}

class Pair implements Comparable<Pair>{
    int index;
    int value;
    Pair(int index, int value) {
        this.index = index;
        this.value = value;
    }

    @Override
    public String toString() {
        return "Pair{" +
                "index=" + index +
                ", value=" + value +
                '}';
    }

    @Override
    public int compareTo(Pair o) {
        return Integer.compare(o.value, this.value);
    }
}