Under construction

Still being built. Things may change

Start of the Pilgrimage

Time limit3sMemory limit1024 MB

Summary
After each item is added, find the largest ratio of total divine power to total weight over any eight of the items collected so far.
Level

Hard8 of 10

Topics
Binary search, Greedy, Sorting
Solved
No attempts yet

Problem

He has finally decided to become a pilgrim, and he is gradually gathering sacred items to prepare for the start of the pilgrimage. God has said that a pilgrim must carry eight distinct sacred items at all times during the journey.

Each sacred item carries divine power that keeps the pilgrim from tiring on the journey. Each item also has weight, and if it is too heavy, it is hard to carry. Let the divine powers of the eight chosen items be P1,P2,⋯ ,P8P_1, P_2, \cdots, P_8, and their weights be W1,W2,⋯ ,W8W_1, W_2, \cdots, W_8. Then the journey becomes easier by P1+P2+⋯+P8W1+W2+⋯+W8\frac{P_1+P_2+\cdots+P_8}{W_1+W_2+\cdots+W_8}.

The items are given in the order he collected them. Each time an item is added, find the maximum ease of the journey when exactly eight of the items he holds are chosen.

Input

The first line contains a natural number NN, the number of sacred items collected. On each of the next NN lines, the ii-th line contains a natural number pip_i, the divine power of the ii-th item collected, and a natural number wiw_i, its weight (1≤pi,wi≤1061 \leq p_i, w_i \leq 10^6).

Output

Print N−7N-7 lines. On the ii-th line, print the maximum ease of the journey when eight items are chosen after i+7i+7 items have been collected. An answer is accepted if its absolute or relative error is at most 10−910^{-9}.

Examples1

  1. Example 1

    Input
    10
    1 1
    1 1
    1 1
    1 1
    1 1
    1 1
    1 1
    1 1
    9 1
    1 2
    
    Expected output
    1.0
    2.0
    2.0