Queens Junior#2874

Queens Junior

1 second
128 megabytes
Easy

On a chessboard of size N \times N, there are queens placed on different squares. A queen can move any number of squares in a straight line or diagonally. Specifically, a queen can move from a square with coordinates to a square with coordinates (x', y') if and only if the absolute differences |x - x'| and |y - y'| are equal and non-zero. We say that one queen threatens another if there is a possible move from the square of the first queen to the square of the second. This relationship is symmetric, meaning if one queen threatens another, then the second queen also threatens the first. A queen is under attack by another if the second queen threatens the first and all squares between them are unoccupied. This relationship is also symmetric.

Your task is to determine two things: the number of pairs of queens that threaten each other and the number of pairs of queens that are under attack by each other.

Input

The first line contains two integers and (1 \leq N \leq 10^6, 0 \leq K \leq 10^5, 1 \leq x, y \leq N). Each of the following lines contains two integers and , which specify the coordinates of each queen.

Output

On the first line, output the number of pairs of queens that threaten each other. On the second line, output the number of pairs of queens that are under attack by each other.

Examples

Example 1

Loading
Loading