Bahoi started playing the online rhythm game osu! and he's trying to farm as much PP (performance points) as possible. Since the scoring system in osu! is not perfect, Bahoi sniped his score on a map with a worse score and, as a result, lost PP. Upset by this atrocity, Bahoi quit osu! and is attempting to create a clone to his liking.
For simplicity, he has currently implemented a single object: the hit circle. It is characterized by the time it appears at in milliseconds (a natural number ) and its position in the 2D plane (natural numbers , ). In Bahosu! (a very original name), the scoring system used is precisely the PP system. He has the following idea for implementing the BPP (Bahoi PP) system: PP is divided into 3 categories, namely Aim PP, Speed PP, and Accuracy PP. Aim PP is calculated as the sum of the Euclidean distances divided by the time differences, multiplied by , between all consecutive pairs of hit circles. Speed PP is calculated as the sum of the inverses of the time differences, multiplied by , between all consecutive pairs of hit circles. Accuracy PP for an accuracy measured in percentage , is calculated as . Total PP is calculated as .
Task
Given a map (a sequence of hit circles) and Bahoi's accuracy (a real number from to , in percentage), calculate the PP he obtained.
Input data
The first line will contain the natural number , representing the number of hit circles, and the real number , representing Bahoi's accuracy.
The next lines describe the -th circle with the triplet of natural numbers , as described above.
Output data
Print a single real number, representing the PP obtained by Bahoi.
Constraints and clarifications
- It is guaranteed that the result can be calculated using
long double
variables in C++. - It is recommended to use the
long double
data type for real number operations in C++. - It is recommended to display the result with decimal places using
std::setprecision(18)
in C++. - Bahoi has not discovered osu!lazer, where you cannot lose PP.
Scoring
Let and .
If , result is considered correct ( of the test).
If , result is considered partially correct ( of the test).
Example 1
stdin
10 100
0 0 0
60 0 101
30 70 202
100 0 404
140 0 505
100 70 606
140 70 707
180 0 909
240 0 1010
210 70 1111
stdout
59.5172
Explanation
Below is a graphical representation of the map Bahoi played:
Bahoi played it perfectly, achieving accuracy.
Bahoi's Aim PP is:
Bahoi's Speed PP is:
Bahoi's Accuracy PP is:
Therefore, Bahoi's Total PP is: .
Example 2
stdin
10 95.6
0 0 0
60 0 101
30 70 202
100 0 404
140 0 505
100 70 606
140 70 707
180 0 909
240 0 1010
210 70 1111
stdout
53.1608
Explanation
In example 2, Bahoi played the exact same map, but with a worse accuracy ().
Bahoi's Aim PP is:
Bahoi's Speed PP is:
Bahoi's Accuracy PP is:
Therefore, Bahoi's Total PP is: .