QOJ.ac

QOJ

Total points: 100

#11041. Dragon Milkdrinker [A]

Statistics

Hard times have come for the citizens of Bytevillage. Dragon Milkdrinker has visited the neighbourhood of their village. It declared that each first day of the month it would come to the village and demand a tribute of $ h $ milliliters of milk. If it does not receive it, it will burn the village to ashes.

Prince Byteman is very worried about the dragon's threat. He is wondering what is the probability that the invader's demand could not be fulfilled. He knows that there are $ n $ cows in the village. He also knows that monthly milking of every cow (in milliliters) is a real number, chosen uniformly from the interval [$ m $,$ M $] and independently from the numbers for the remaining cows.

Help prince Byteman and compute the probability of occurence of such unfortunate situation, in which the village will be burned due to the lack of possibility of fullfillment of the dragon's demand.

Input Format

The first line of the standard input contains five integers $ n $, $ m $, $ M $, $ h $ and $ d $ (1 ≤ $ n $ ≤ 3 000, 0 ≤ $ m $ ≤ $ M $ ≤ 10^{9}, 0 ≤ $ h $ ≤ 10^{9}, 1 ≤ $ d $ ≤ 10 000). These numbers denote: the number of cows in the village, the minimal monthly milking, the maximal monthly milking, the amount of the tribute and the expected precision of the output.

Output Format

The only line of the standard output should contain a number $ p $ written as a decimal fraction, representing an approximation of the probability of not fullfilling the dragon's demand. The fraction should be rounded $ down $ and have exactly $ d $ digits after the dot.

Example

Input

2 4 6 11 5

Output

0.87500

or upload files one by one:

Discussions

About Discussions

The discussion section is only for posting: Editorials, General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues. Submitting multiple issues may cause your account to be banned.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.