After the Wedding
Time limit1sMemory limit1024 MB
Find the limit of the average cut force when a piecewise linear solid of revolution is split into many equal-volume pieces, output modulo 998244353.
- Level
Medium6 of 10
- Topics
- Math, Geometry, Implementation
- Solved
- No attempts yet
Problem
Seolyeong is handing out cake to guests who attended the wedding. Every guest gets one piece, and all pieces must have the same volume.
At first the cake is a single block. Its shape is the solid formed by rotating about the -axis the region enclosed by the graph of (), the lines and , and the -axis. The graph of is drawn by connecting the points , , , with line segments in this order. Here .
To keep the pieces as neat as possible, Seolyeong always cuts the cake along a plane perpendicular to the axis of rotation. Since the cake must be divided among guests, Seolyeong makes exactly cuts. It can be proven that there is only one way to cut the cake under these conditions.
The force needed for a cut is proportional to the area of the cut face. If a cut produces a cross-section with area , the force used is . Let be the forces used in the cuts, and let be their average. Find
Input
The first line contains an integer .
The second line contains integers separated by spaces.
The third line contains integers separated by spaces.
These values define the graph that gives the shape of the cake, drawn by connecting , , , with line segments in this order.
Output
On the first line, print the value of , where is written as an irreducible fraction . is a prime. You can prove that is always a rational number.