Counting Columns

You are standing inside an ancient Measharan monument. It consists of an infinite number of regular hexagonal columns, arranged in a regular hexagonal grid. Each edge of each column is parallel to some line segment between the two nearest columns (like on the picture).

image

Given the distance between two columns dd and the edge length of each column rr, compute the number of columns that you can see.

Input

Input consists of several cases. Each case consists of two positive integers: dd (distance between the centers of two columns), rr (the edge length of each column). You can assume that 2r<d2r < d, and that 1d,r100001 \leq d,r \leq 10000.

After the last case the input contains a line containing 0 0.

Output

Output the number of visible columns.

We have three consonants and two wovels, say, aa, bb, cc, dd, ee. According to our definition, there are 5 words of length 1 (all letters), and 25 words of length 2 (all possible pairs of letters). At length 3 the answer is 98 (out of 535^3 possible words, 333^3 consists of only wovels, which makes them illegible).

Problem information

Author: Eryk Kopczynski

Generation: 2026-01-25T23:03:57.593Z

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