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.*;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.math.RoundingMode;
import java.util.*;
import java.util.Map.Entry;

public class Main
{
	private InputStream stream;
	private byte[] buf = new byte[1024];
	private int curChar;
	private int numChars;
	private SpaceCharFilter filter;
	private PrintWriter pw;
	private long mod = 1000000000
			+ 7;

	private StringBuilder ans_sb;
	private long sum = 0;
	private int[] cnt;

	private void soln()
	{
		int hh = nextInt();
		int mm = nextInt();
		double h = nextInt();
		double d = nextInt();
		double c = nextInt();
		double n = nextInt();
		if (hh < 20)
		{
			double tot = (int) Math
					.ceil(h / n);
			double cost = 0.8
					* c;

			double diff = 60
					* (20 - hh);
			diff -= mm;
			double tot1 = (int) Math
					.ceil((h + diff
							* d)
							/ n);
			// debug(tot1);

			pw.println(
					Math.min(
							tot * c,
							tot1 * cost));
		} else
		{
			double tot = (int) Math
					.ceil(h / n);
			double cost = 0.8
					* c;
			pw.println(
					tot * cost);
		}
	}

	class BitsetLong
	{

		static final int LOG = 6;
		static final int SIZE = 1 << LOG;
		static final int MASK = SIZE
				- 1;

		private long[] data;

		public BitsetLong(
				int n)
		{
			data = new long[(n >> LOG)
					+ 2];
		}

		void set(
				int i)
		{
			data[i >> LOG] |= 1L << (i
					& MASK);
		}

		void unset(
				int i)
		{
			data[i >> LOG] &= ~(1L << (i
					& MASK));
		}

		void flip(
				int i)
		{
			data[i >> LOG] ^= 1L << (i
					& MASK);
		}

		int get(int i)
		{
			return (int) ((data[i >> LOG] >>> (i
					& MASK))
					& 1);
		}

		void print()
		{
			for (int i = 0; i < data.length; i++)
			{
				System.out
						.print(Long
								.toString(
										data[i],
										2));
			}
			System.out
					.println();
		}

		long getWord(
				int i)
		{
			if (i <= -SIZE
					|| (i >> LOG)
							+ 1 >= data.length)
			{
				return 0;
			}
			int rem = i
					& MASK;
			int idx = i >> LOG;

			if (rem == 0)
			{
				return data[idx];
			}

			long head = idx < 0
					? 0
					: (data[idx] >>> rem);
			long tail = data[idx
					+ 1] << (SIZE
							- rem);

			return head
					| tail;
		}
	}

	int count(
			long[] bs,
			int len)
	{
		int ret = 0;
		for (int i = 0; i << 6 < len; i++)
		{
			if (((i + 1) << 6) <= len)
			{
				ret += Long
						.bitCount(
								bs[i]);
			} else
			{
				int rem = len
						& 63;
				ret += Long
						.bitCount(
								bs[i] << (64
										- rem));
			}
		}
		return ret;
	}

	private class Pair
			implements
			Comparable<Pair>
	{
		int v, i,
				j;

		public Pair(
				int a,
				int b,
				int c)
		{
			v = a;
			i = b;
			j = c;
		}

		@Override
		public int compareTo(
				Pair arg0)
		{
			return this.v
					- arg0.v;
		}
	}

	private class Bridge
	{
		private LinkedList<Edge>[] graph;
		private LinkedList<Integer>[] tree;
		private int t;
		private boolean[] isBridge;
		private int[] cno;

		public Bridge(
				int n,
				int m)
		{
			pre(n, m);
		}

		private class Edge
		{
			int u, v,
					i;

			public Edge(
					int a,
					int b,
					int c)
			{
				u = a;
				v = b;
				i = c;
			}
		}

		private void pre(
				int n,
				int m)
		{
			graph = new LinkedList[n];
			tree = new LinkedList[n];
			for (int i = 0; i < m; i++)
			{
				int u = nextInt()
						- 1;
				int v = nextInt()
						- 1;
				Edge e = new Edge(
						u,
						v,
						i);
				graph[u].add(
						e);
				graph[v].add(
						e);
			}
			isBridge = new boolean[m];
			cno = new int[n];
			boolean[] v = new boolean[n];
			int[] arr = new int[n];
			for (int i = 0; i < n; i++)
				if (!v[i])
					dfs(i, null,
							v,
							arr);
		}

		private int dfs(
				int u,
				Edge e,
				boolean[] v,
				int[] arr)
		{
			v[u] = true;
			arr[u] = t++;
			int min = arr[u];
			Iterator<Edge> it = graph[u]
					.listIterator();
			while (it
					.hasNext())
			{
				Edge x = it
						.next();
				int w = x.u;
				if (x.u == u)
					w = x.v;
				if (!v[w])
					min = Math
							.min(min,
									dfs(w, x,
											v,
											arr));
				else if (x != e)
					min = Math
							.min(min,
									arr[w]);
			}
			if (min == arr[u]
					&& e != null)
				isBridge[e.i] = true;
			return min;
		}

		private void bfs(
				int u,
				int cmpNo,
				Queue<Integer>[] q,
				boolean[] v)
		{
			int cur = cmpNo;
			cno[cur] = cmpNo;
			q[cur].add(
					u);
			v[u] = true;
			while (!q[cur]
					.isEmpty())
			{
				int x = q[cur]
						.poll();
				Iterator<Edge> it = graph[x]
						.listIterator();
				while (it
						.hasNext())
				{
					Edge x1 = it
							.next();
					int w = x1.u;
					if (w == x)
						w = x1.v;
					if (!v[w])
					{
						if (isBridge[x1.i])
						{
							tree[cur]
									.add(0, cmpNo
											+ 1);
							tree[cmpNo
									+ 1].add(
											0,
											cur);
							bfs(w, cmpNo
									+ 1,
									q,
									v);
						} else
						{
							bfs(w, cmpNo,
									q,
									v);
						}
					}
				}
			}
		}
	}

	private String solveEqn(
			long a,
			long b)
	{
		long x = 0,
				y = 1,
				lastx = 1,
				lasty = 0,
				temp;
		while (b != 0)
		{
			long q = a
					/ b;
			long r = a
					% b;
			a = b;
			b = r;
			temp = x;
			x = lastx
					- q * x;
			lastx = temp;
			temp = y;
			y = lasty
					- q * y;
			lasty = temp;
		}
		return lastx
				+ " "
				+ lasty;
	}

	private void debug(
			Object... o)
	{
		System.out
				.println(
						Arrays.deepToString(
								o));
	}

	private long pow(
			long a,
			long b,
			long c)
	{
		if (b == 0)
			return 1;
		long p = pow(
				a,
				b / 2,
				c);
		p = (p * p)
				% c;
		return (b
				% 2 == 0)
						? p
						: (a * p)
								% c;
	}

	private long gcd(
			long n,
			long l)
	{
		if (l == 0)
			return n;
		return gcd(
				l,
				n % l);
	}

	public static void main(
			String[] args)
			throws Exception
	{
		new Thread(
				null,
				new Runnable()
				{
					@Override
					public void run()
					{
						new Main()
								.solve();
					}
				},
				"1",
				1 << 26).start();
		// new Main().solve();
	}

	public StringBuilder solve()
	{
		InputReader(
				System.in);
		/*
		 * try { InputReader(new FileInputStream("C:\\Users\\hardik\\Desktop\\in.txt"));
		 * } catch(FileNotFoundException e) {}
		 */
		pw = new PrintWriter(
				System.out);
		// ans_sb = new StringBuilder();
		soln();

		pw.close();
		// System.out.println(ans_sb);
		return ans_sb;
	}

	public void InputReader(
			InputStream stream1)
	{
		stream = stream1;
	}

	private boolean isWhitespace(
			int c)
	{
		return c == ' '
				|| c == '\n'
				|| c == '\r'
				|| c == '\t'
				|| c == -1;
	}

	private boolean isEndOfLine(
			int c)
	{
		return c == '\n'
				|| c == '\r'
				|| c == -1;
	}

	private int read()
	{
		if (numChars == -1)
			throw new InputMismatchException();
		if (curChar >= numChars)
		{
			curChar = 0;
			try
			{
				numChars = stream
						.read(buf);
			} catch (IOException e)
			{
				throw new InputMismatchException();
			}
			if (numChars <= 0)
				return -1;
		}
		return buf[curChar++];
	}

	private int nextInt()
	{
		int c = read();
		while (isSpaceChar(
				c))
			c = read();
		int sgn = 1;
		if (c == '-')
		{
			sgn = -1;
			c = read();
		}
		int res = 0;
		do
		{
			if (c < '0'
					|| c > '9')
				throw new InputMismatchException();
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(
				c));
		return res
				* sgn;
	}

	private long nextLong()
	{
		int c = read();
		while (isSpaceChar(
				c))
			c = read();
		int sgn = 1;
		if (c == '-')
		{
			sgn = -1;
			c = read();
		}
		long res = 0;
		do
		{
			if (c < '0'
					|| c > '9')
				throw new InputMismatchException();
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(
				c));
		return res
				* sgn;
	}

	private String nextToken()
	{
		int c = read();
		while (isSpaceChar(
				c))
			c = read();
		StringBuilder res = new StringBuilder();
		do
		{
			res.appendCodePoint(
					c);
			c = read();
		} while (!isSpaceChar(
				c));
		return res
				.toString();
	}

	private String nextLine()
	{
		int c = read();
		while (isSpaceChar(
				c))
			c = read();
		StringBuilder res = new StringBuilder();
		do
		{
			res.appendCodePoint(
					c);
			c = read();
		} while (!isEndOfLine(
				c));
		return res
				.toString();
	}

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

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

	private void pArray(
			int[] arr)
	{
		for (int i = 0; i < arr.length; i++)
		{
			System.out
					.print(arr[i]
							+ " ");
		}
		System.out
				.println();
		return;
	}

	private void pArray(
			long[] arr)
	{
		for (int i = 0; i < arr.length; i++)
		{
			System.out
					.print(arr[i]
							+ " ");
		}
		System.out
				.println();
		return;
	}

	private boolean isSpaceChar(
			int c)
	{
		if (filter != null)
			return filter
					.isSpaceChar(
							c);
		return isWhitespace(
				c);
	}

	private char nextChar()
	{
		int c = read();
		while (isSpaceChar(
				c))
			c = read();
		char c1 = (char) c;
		while (!isSpaceChar(
				c))
			c = read();
		return c1;
	}

	private interface SpaceCharFilter
	{
		public boolean isSpaceChar(
				int ch);
	}
}