All problems

How Often Is a Positive Test Wrong?

mediumPythonBayes' Theorem

After a run of complaints, the Northbeam Health board has put a blunt question to the screening team: of all the residents we frighten with a positive letter, how many turn out to be perfectly fine? Comms wants that figure printed on the leaflet that goes out with every positive result, so that nobody spends the fortnight before their follow-up appointment assuming the worst.

A leaflet is printed for every programme the county runs, and the answer differs wildly between them, so it is worked out from that programme's three rates: how common the illness is, how often an ill person tests positive, and how often a healthy person is told they are positive anyway.

Task: Print the probability that a resident who tested positive does not have the illness, as a single number rounded to 4 decimals. Round once, at the end.

Input

Three lines, each a decimal between 0 and 1: how common the illness is in the county, then the chance an ill person tests positive, then the chance a healthy person tests positive.

Output

One line holding the probability, rounded to 4 decimals and printed the way Python prints a float - 0.9124.

Example:

Input:
0.01
0.95
0.1

Output:
0.9124

Sign in to solve this problem

Reading problems is free for everyone — solving them (Run, Submit, and tracking what you've solved) needs an account.

Sign in

Discussion

Sign in to join the discussion — reading is open to everyone.

Loading comments…