Primes

아직 제출이 없습니다시간 제한8초메모리 제한256 MB

문제

This is an interactive problem.

For two positive integers x,yx,y, we define π(x,y)\pi(x,y) to be the number of distinct primes that divide both xx and yy. For example π(2,3)=0\pi(2,3)=0, π(8,16)=1\pi(8,16)=1 and π(30,105)=2\pi(30,105)=2.

For two positive integers a,ba,b, where aba\leq b, we define S(a,b)S(a,b) to be the sum of values π(x,y)\pi(x,y) over all pairs of integers (x,y)(x,y) satisfying ax<yba\leq x < y\leq b.

Your task is to compute the values S(a,b)S(a,b) for many query pairs (a,b)(a,b). To make your task more challenging, all the queries have to be answered online.

입력

The first line of the input contains a single integer qq (1q51041\leq q\leq 5\cdot 10^4), denoting the number of queries. The next qq lines describe the queries. The ii-th of these lines contains two integers a_i,b_ia\_i,b\_i (1a_ib_i1061\leq a\_i\leq b\_i\leq 10^6).

Note that the ii-the query (i2i\geq 2) will be available at the input only after you output the answer to the (i1)(i-1)-th query.

출력

You should print exactly qq lines. The ii-th of these lines should contain the value S(a_i,b_i)S(a\_i,b\_i).

Do not forget to flush the output after answering each query.