Gather at one point

For each query [l, r], find the minimum sum of Chebyshev distances from the people l..r to a freely chosen point.

Medium7Prefix sumDivide and conquerMathSortingNo attempts yetTime limit5sMemory limit512 MB

Problem

NN people stand on a two dimensional plane. The people are numbered from 1 to NN.

The distance between two points (x1,y1)(x_1, y_1) and (x2,y2)(x_2, y_2) is max(x1x2,y1y2)\max(|x_1 - x_2|, |y_1 - y_2|).

Write a program that answers the following query.

  • l r: person ll through person rr gather at a single point PP on the plane. Print the minimum possible sum of the distances between each of those people and PP.

The point PP can be anywhere on the plane, and its coordinates do not have to be integers.

Input

The first line contains the number of people NN and the number of queries QQ, separated by a space. (1N,Q1000001 \le N, Q \le 100\,000)

Each of the next NN lines contains the coordinates XiX_i and YiY_i of person ii, separated by a space. (1000000000Xi,Yi1000000000-1\,000\,000\,000 \le X_i, Y_i \le 1\,000\,000\,000)

Each of the next QQ lines contains LiL_i and RiR_i of a query, separated by a space. (1LiRiN1 \le L_i \le R_i \le N)

Output

Print the answer to each query on its own line, in the order the queries are given.

The answer is always a multiple of 0.50.5, so print it with exactly one digit after the decimal point. Print 5.0 for an answer of 55 and 8.5 for an answer of 8.58.5.

Hint

In the first example, the first query is minimized by gathering at (1.5,2.5)(1.5, 2.5), and the second query is minimized by gathering at (1,1)(1, 1).