#t284. 垃圾炸弹
垃圾炸弹
Garbage Bomb
Problem Background
Special for beginners, ^_^
Problem Description
The 2118 FIFA World Cup has kicked off! To let fans watch the matches conveniently, many intersections in the streets of Moscow have large live-screen displays. But after the crowds disperse, a pile of garbage is always left at these intersections. To deal with this, the Russian government decided to use a newly invented "garbage bomb". Using the most advanced quantum physics technology, the shockwave after the explosion can completely clear all garbage within its affected area, without any other side effects. The shockwave spreads in a square shape; the bomb's power (spread distance) is given by , meaning it can travel blocks.
For example, the figure below shows the affected area of a "garbage bomb" with .

Suppose Moscow's layout is a strict grid. Because of financial constraints the city can only afford one "garbage bomb". They hope you can help them find a suitable drop location so that the total amount of garbage cleared in one shot is maximized (the garbage amount at an intersection is represented by a non-negative integer not exceeding , and there is no garbage anywhere except at the intersections with screens).
Input Format
The first line gives the bomb's power .
The second line gives an integer , the number of intersections with screens (and thus with garbage).
The next lines each give three numbers , representing the intersection's coordinates and the amount of garbage .
The point coordinates are guaranteed to be valid (in the range to ), and the same coordinate is given at most once.
Output Format
Output the number of drop points that clear the most garbage, and the total amount of garbage that can be cleared.
Sample Input
1
2
4 4 10
6 6 20
Sample Output
1 30
Constraints
1s, 1024KiB for each test case.