cho.sh
Notes
Loading...

Transparent Mosaic

Time limit

2s

Memory limit

128 MB

Problem

Sejun has a mosaic made of 100×100 small 1×1 pictures. One day, he disliked some parts of the mosaic and began covering them with N opaque sheets of paper.

A cell does not necessarily become invisible just because it is covered by paper. If a cell has at most M sheets on top of it, the picture in that cell is still visible. Only cells covered by more than M sheets are invisible.

Each sheet is given by the coordinates of its lower-left corner and upper-right corner. The covered area includes both corner coordinates. For example, covering from (1, 1) to (2, 2) covers four cells: (1, 1), (1, 2), (2, 1), and (2, 2).

Find the number of invisible cells in the 100×100 mosaic.

Input

The first line contains integers N and M. Both N and M are between 0 and 50, inclusive.

Each of the next N lines describes one sheet of paper. A line contains the x and y coordinates of the lower-left corner, followed by the x and y coordinates of the upper-right corner. Every coordinate is a positive integer not greater than 100.

Output

Print the number of invisible cells on the first line.