Timpani Retuning

Choose tunings for up to 4 ordered drums before each of N notes so the shortest retuning interval time is maximized; output that time rounded to two decimals.

Hard8Binary searchDynamic programmingGreedyImplementationNo attempts yetTime limit2sMemory limit512 MB

Problem

A timpano is a large drum that is tuned to one pitch and sounds only that pitch. A player uses DD timpani, numbered 1, 2, ..., DD from the lowest one up.

The piece to be played has NN notes. Note ii sounds TiT_i seconds into the piece and has pitch PiP_i. Every note of the piece lies inside a single octave, from F up to E, and those twelve pitches are numbered 1 through 12 from the lowest one up.

123456789101112
FF#GG#AA#BCC#DD#E

A timpano can be tuned only to one of these twelve pitches. A drum sounds only the pitch it is tuned to at that moment, so note ii can be played if and only if one of the drums is tuned to PiP_i at time TiT_i.

Before the piece starts, the player tunes each drum to any pitch, and that costs no time. During the piece the player has to retune drums to reach the required pitches on time. The rules for retuning are these.

  • At every moment, drum i+1i+1 must be tuned higher than drum ii. While one drum is retuned its pitch passes through the pitches between the old one and the new one, so this order must hold throughout the retuning.
  • One retuning covers one drum and takes one uninterrupted interval of time. During that interval no note sounds and no other drum is retuned.
  • So if kk retunings happen between note ii and note i+1i+1, those kk intervals must fit without overlapping inside an interval of length Ti+1TiT_{i+1} - T_i.

Retuning is hard work, so the player wants as much time as possible for it. Find the time of the shortest retuning in the piece when that time is made as large as possible.

Input

The first line contains the number of notes NN and the number of drums DD. (1N1001 \le N \le 100, 1D41 \le D \le 4)

Each of the next NN lines contains the time TiT_i and the pitch PiP_i of note ii. (0T1<T2<<TN1090 \le T_1 < T_2 < \cdots < T_N \le 10^9, 1Pi121 \le P_i \le 12)

All input values are integers.

Output

Print on one line the largest time in seconds that the shortest retuning can get. Round the value at the third decimal place and always print two digits after the decimal point. If the whole piece can be played without a single retuning, print 0.00.

The exact answer is a reduced fraction whose denominator is at most DD, so the rounding is never ambiguous.