Wandering
Time limit1sMemory limit256 MB
Given n radii, compute the expected squared distance from the origin after n independent uniform steps inside disks of those radii.
- Level
Medium4 of 10
- Topics
- Probability, Math, Geometry, Implementation
- Solved
- No attempts yet
Problem
Rikka is a talented student.
She likes to wander in the corridor while solving ICPC problems. Specifically, she takes a random walk of steps. In the -th random step, she chooses one of the vectors such that and with equal probability. Then she walks along that vector. In other words, if she stood at before the random step, she stands at afterwards. Before wandering, she stands at the door .
After wandering, she became curious about the expected value of the square of the Euclidean distance to the point . In other words, if she stands at after all random steps, she wants to know the expected value of .
Input
The first line contains an integer , the number of random steps.
The second line contains positive integers , the parameter of the -th random step.
It is guaranteed that and .
Output
You must output , the expected value of . Letting the correct answer be , you must ensure that .