{"raw_statement":[{"iden":"statement","content":"Zeyad and Ehab are playing a simple card game, each player initially has a deck of $n$ cards numbered from $1$ to $n$, the game lasts $n$ turns and in each turn both players privately choose one card and then both players reveal the chosen cards, the player that chose the card with the higher number earns points equal to that number, for example if Ehab chooses $4$ and Zeyad chooses $6$ Zeyad earns $6$ points, if the numbers chosen are equal no one earns any point, the cards chosen do not return to the deck, they are discarded instead.\n\n Ehab doesn't care about winning or losing, he cares about mathematical values of the game, specifically he wants to know the expected number of points he'll earn considering all possible outcomes, can you help him?\n\nThe first and only line of input contains a single integer $n (1 <= n <= 10^6)$.\n\nPrint a real number, the expected number of points Ehab will earn in the game. \n\n The answer is considered correct if the absolute or relative error is not greater than $10^(-6)$.\n\n"},{"iden":"input","content":"The first and only line of input contains a single integer $n (1 <= n <= 10^6)$."},{"iden":"output","content":"Print a real number, the expected number of points Ehab will earn in the game.  The answer is considered correct if the absolute or relative error is not greater than $10^(-6)$."},{"iden":"examples","content":"Input3\nOutput2.6666666667Input7\nOutput16.0000000000"}],"translated_statement":null,"sample_group":[],"show_order":[],"formal_statement":"**Definitions**  \nLet $ n \\in \\mathbb{Z}^+ $ be the number of rooms.  \nLet $ P = \\{(a_i, b_i) \\mid i \\in \\{1, \\dots, n\\}\\} $ be the set of patient profiles, where $ a_i \\in \\mathbb{Z}^+ $ is the food demand and $ b_i \\in \\mathbb{Z}^+ $ is the maximum safe food visibility for patient in room $ i $.  \nLet $ D \\subseteq \\{1, \\dots, n\\} $ be the set of rooms with dead patients (initially $ D = \\emptyset $).  \n\n**Constraints**  \n1. $ 1 \\leq n \\leq 10^5 $  \n2. $ 1 \\leq a_i \\leq 10^9 $, $ 1 \\leq b_i \\leq 10^{18} $ for all $ i \\in \\{1, \\dots, n\\} $  \n3. $ 1 \\leq q \\leq 10^5 $  \n\n**Objective**  \nProcess $ q $ queries:  \n\n1. **Query type 1 ($ 1 \\ x $)**:  \n   Given food supply $ x \\in \\mathbb{Z}^+ $, simulate robot traversal:  \n   - Initialize cumulative food used $ s = 0 $.  \n   - For $ i = 1 $ to $ n $:  \n     - If $ i \\in D $, skip.  \n     - Else if $ a_i > x - s $, stop traversal.  \n     - Else if $ s + a_i > b_i $, mark $ i \\in D $ (patient dies).  \n     - Else, set $ s \\leftarrow s + a_i $.  \n   - Let $ d = |D| $ (number of dead patients after traversal).  \n   - Let $ u = $ number of rooms $ i \\notin D $ such that $ a_i > x - s $ (patients who didn’t receive food).  \n   - Output $ (d, u) $.  \n\n2. **Query type 2 ($ 2 \\ a \\ b \\ c $)**:  \n   Replace patient in room $ c $ with new patient $ (a, b) $:  \n   - If $ c \\in D $, remove $ c $ from $ D $.  \n   - Set $ (a_c, b_c) \\leftarrow (a, b) $.","simple_statement":"You have n rooms, each with a patient who needs a_i food and can safely see at most b_i food. A robot starts at room 1 with x food. For each room:\n\n- If a_i > current food, robot stops and leaves. Patient gets no food.\n- Else, robot gives a_i food. If total food shown so far > b_i, patient dies.\n- Robot continues to next room if alive and food remains.\n\nYou must handle two queries:\n\n1. Given x (food amount), count: (deaths, no-food patients)\n2. Replace patient in room c with new patient (a, b)\n\nPrint results for type-1 queries.","has_page_source":false}