Hello, codeforces!
Sorry for the long break, but the last weeks of holidays and the first weeks of academic year took my attention. I hope today's trick will make you forgive me. :P
I invented this trick a few years ago, but for sure I wasn't first, and some of you already know it. Let's consider the following interactive task. There are n (1 ≤ n ≤ 105) hidden integers ai, each of them from range [1, 1018]. You are allowed to ask at most 103000 queries. In one query you can choose two integers x and y (1 ≤ x ≤ n, 1 ≤ y ≤ 1018) and ask a question ''Is ax ≥ y?'' The task is to find the value of the greatest element in the hidden array. The checker isn't adaptive.
Unfortunately, this task is only theoretical, and you cannot solve it anywhere, but it'll turn out, that solution can be handy in many other, much more complicated problems.







topmost pieces of paper and fill these orders in total time
. Two words are
and
are really different and words
and
are not, because in both of them the third character is
. As there can be many such pairs (up to
), if there are more than 

. Also, for fixed 
, till we succeed. How to calculate the expected time for one region
, so the expected time is
. So, in total we should sum up values
for
for all 


, with big constant factor.
is small enough. Unfortunately, there exist malicious tests. Consider a tree with
paths from root, each with length 



