luogu#P5104. 红包发红包
红包发红包
Background
Redbag invented a redbag-grabbing system.
Problem Description
This redbag-grabbing system works like this: suppose there are currently yuan. Then the amount of money you can get from grabbing a redbag is a real number chosen uniformly at random from with equal probability.
Now Redbag releases a redbag worth yuan, and there are people grabbing it. What is the expected amount of money that the -th person will get?
Output the result modulo .
Input Format
One line with three integers, .
Output Format
Output the expected amount of money the -th person gets, taken modulo .
Note: The expectation may be a fraction. For how to take a fraction modulo, you can search online (Du Niang).
2 1 1
1
Hint
Note that Redbag’s redbag-grabbing system is different from WeChat’s redbag system. In Redbag’s system, the money is not necessarily an integer number of cents.
- For of the testdata, .
- For another of the testdata, the expectation is an integer before taking modulo, and .
For all testdata, , .
Translated by ChatGPT 5