시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
3 초 512 MB 3 3 3 100.000%

문제

As captain of your space ship you have never encountered a more fierce enemy than the one you have snuck upon now. You immediately bring out the big phaser cannon hoping to take out the flagship before they discover you. There is no room for mistakes and the shot will have to be perfect if you are to stand any chance at all against the flagship of the enemy.

You start charging the phaser beam and retrieve the room layout of the flagship from the archives. You are situated directly above the enemy, from where the layout of the flagship can be modeled by a two-dimensional map of the rooms of the flagship. In this map, each room is a rectangle with sides parallel to the x and y axes (rectilinear), and no two rooms intersect (not even in a single point).

The phaser beam is configured by giving a point (x, y) and an angle ϑ. The phaser beam will start at (x, y) and travel a distance ` in the direction specified by ϑ, causing severe damage to every room touched by the phaser beam. Due to this, you aim at hitting as many rooms as possible.

The phaser beam is almost fully charged and the only missing piece is an optimal configuration of the weapon. Unfortunately, it turns out to be harder than you expected. However, there are still ten seconds before the charging is completed and hence you decide to make a computer program to solve the problem.

입력

The first line of input consists of two integers r and ℓ (1 ≤ r ≤ 15, 1 ≤ ℓ ≤ 1 000) where r is the number of rooms in the flagship and ℓ is the length of a shot of the phaser.

Then follow r lines, each of which contains four integers x1, y1, x2, y2 (0 ≤ x1 < x2 ≤ 1 000, 0 ≤ y1 < y2 ≤ 1 000), indicating that there is a room in the flagship with lower left corner (x1, y1) and upper right corner (x2, y2).

출력

Output one line with the maximum number of rooms that can be hit by one phaser beam. Recall that if the beam touches a room it is counted as a hit.

You may assume that the answer is numerically stable in the following sense: if all rooms are expanded by a distance of 10−6 in all four directions, the answer does not change.

예제 입력 1

5 8
2 1 4 5
5 1 12 4
5 5 9 10
1 6 4 10
2 11 7 14

예제 출력 1

4

예제 입력 2

3 6
2 2 3 3
5 3 6 4
6 6 7 7

예제 출력 2

3