Time limit
1s
Memory limit
128 MB
Seongjun is extremely sensitive to caffeine. Even a tiny amount makes him agitated enough to affect nearby people or objects.
Research found the following rules.
8*N - t/12.2*N - t*t/79.The effects of all foods are independent. At any time T, the safety distance is defined as the sum of the positive effect radii of every food Seongjun has consumed at or before time T. If the effect radius of a food becomes negative, that food has been fully digested and contributes nothing.
For emergencies, the safety distance must always be at least 1.
You are given the times and amounts of foods Seongjun consumed, along with several query times T. For each query time, compute the safety distance.
Input is given until end of file. Each line has one of the following three forms.
Query T: asks for the safety distance at time T. T is a nonnegative integer.Chocolate T N: Seongjun ate N units of chocolate at time T. T is a nonnegative integer, and N is a nonnegative real number.Coffee T N: Seongjun drank N units of coffee at time T. T is a nonnegative integer, and N is a nonnegative real number.The lines are not necessarily given in chronological order.
There are at most 10,000 Query lines. The total number of Chocolate and Coffee lines is at most 100.
For every Query in the input, output one line in increasing order of query time.
T R
T is the query time, and R is the safety distance at that time rounded to one decimal place.
If the same query time appears multiple times, output an answer for that time as many times as it appears.
The input data are chosen so that an error of at most 10^-8 from the exact value will not change the rounded result.
T <= 1,000,000N <= 2,000,000N is given with at most three digits after the decimal point.