Triangle Hunt

Measharan Bees have built a regular triangle made of hexagonal honeycells. Each honeycell contains some amount of honey.

image

Now, we want to sell exactly MM units of honey. For this, we have to cut out a triangle which contains exactly MM units. We only consider regular triangles which have a horizontal edge here.

In the picture above, there are two triangles, each of which contains 10 honeycells with 100 units of honey each. All other triangles contain a number other than 1000 (there would be a third solution if the cell with 15 units contained 10 units).

Input

The first line of input contains two numbers NN and MM (1N500,1M500001 \leq N \leq 500, 1 \leq M \leq 50000).

The ii-th of the following numbers contains ii numbers, each of them in range from 00 to 1000010000. The picture above corresponds to the sample.

Output

Output the number of triangles which contain exactly MM units of honey.

Problem information

Author: Eryk Kopczynski

Generation: 2026-01-25T13:23:16.717Z

© Jutge.org, 2006–2026.
https://jutge.org