A coder cannot sit and code all day. Sometimes it is a good idea to rise from the desk, have a rest, have small talk with colleagues and even play. The coders of the F company have their favorite ball game.

Let's imagine the game on the plane with a cartesian coordinate system. The point (0, 0) contains the player who chooses an arbitrary direction and throws a ball in that direction. The ball hits the plane at distance d from the player's original position and continues flying in the same direction. After the ball hits the plane for the first time, it flies on and hits the plane again at distance 2·d from the player's original position and so on (it continue flying in the chosen direction and hitting the plane after each d units). All coders in the F company are strong, so the ball flies infinitely far away.

The plane has n circles painted on it. If a ball hits the plane and hits a circle that is painted on the plane (including its border), then the player gets one point. The ball can hit multiple circles at once and get one point for each of them (if the ball hits some circle x times during the move, the player also gets x points). Count the maximum number of points a player can get if he throws a ball in the arbitrary direction. Note that the direction may have real cooridinates.

Input

The first line contains two space-separated integers — n и d (1 ≤ n ≤ 2·104; 5 ≤ d ≤ 10). Next n lines contain the circles' description. The i-th line contains three space-separated integers xi, yi, ri ( - 10000 ≤ xi, yi ≤ 10000; 1 ≤ r ≤ 50), where (xi, yi, ri) are the coordinates of the center and the radius of the circle, correspondingly. The point (0, 0) is not inside or on the border of some circle.

Output

Print a single integer — the maximum number of points you can get.

Examples

Input

2 5
1 1 1
5 0 1


Output

1


Input

2 5
4 0 3
5 3 1


Output

2


Input

1 10
20 0 10


Output

3
#include <bits/stdc++.h>
using namespace std;
int n, cnt, ans;
vector<pair<double, int> > q;
double d, lt, rt, dist, dist2, alpha, theta, D, TP = 2.0 * acos(-1.0);
vector<double> first, second, r;
double norm(double t) {
  while (t < 0) t += TP;
  while (t > TP) t -= TP;
  return t;
}
int main(int argc, char const* argv[]) {
  ios::sync_with_stdio(false);
  cin >> n >> d;
  first = vector<double>(n), second = vector<double>(n), r = vector<double>(n);
  for (int i = 0; i < n; i += 1) cin >> first[i] >> second[i] >> r[i];
  for (int i = 0; i < n; i += 1) {
    dist2 = first[i] * first[i] + second[i] * second[i];
    dist = sqrt(dist2);
    theta = atan2(second[i], first[i]);
    int k = int((dist - r[i]) / d);
    while (double(k) * d + r[i] < dist) k++;
    for (D = double(k) * d; D <= dist + r[i] + (1e-9); D += d) {
      alpha = acos((D * D + dist2 - r[i] * r[i]) / (2.0 * D * dist));
      lt = norm(theta - alpha), rt = norm(theta + alpha);
      if (lt <= rt) {
        q.push_back(make_pair(lt, -1));
        q.push_back(make_pair(rt, 1));
      } else {
        q.push_back(make_pair(0.0, -1));
        q.push_back(make_pair(rt, 1));
        q.push_back(make_pair(lt, -1));
        q.push_back(make_pair(TP, 1));
      }
    }
  }
  sort(q.begin(), q.end());
  cnt = 0;
  ans = 0;
  for (int i = 0; i < (int)(q.size()); i += 1) {
    if (q[i].second == -1)
      cnt++;
    else
      cnt--;
    ans = max(ans, cnt);
  }
  cout << ans << '\n';
  return 0;
}
