Problem H
Habeas Corpus
“The power to arrest–to deprive a citizen of liberty–must be used fairly, responsibly, and without bias.” –Loretta Lynch.
Due to desperation caused by the global financial crisis, you, left with no other options, decided to rob a bank to survive. Unfortunately, while you were able to escape with a small fortune, the city’s police is now out in full force trying to hunt you down.
The city can be represented as a grid with
You have intercepted the officer’s calls and have discovered
that the police force intends to, for the next
You hence also intend to hide at a random location in the city. You will choose a block uniformly at random and hide there, hoping that it is not a block the police will search. Since you have no idea where the police are, this may unfortunately also be a block the police is currently at (and will definitely search).
You can assume that, unfortunately, the police are very
thorough in their search and they will definitely catch you if
they search the block you are in. However, if the
What is the probability that you will evade capture?
Input
The first and only line of input contains three integers,
Output
It can be shown that the probability of evading capture can
be uniquely represented as an irreducible fraction
Output a single integer on a line by itself, containing the
remainder after dividing
The input will be such that
Sample Input 1 | Sample Output 1 |
---|---|
5 4 2 |
14500000001 |
Sample Input 2 | Sample Output 2 |
---|---|
5 4 100 |
0 |