Counting Columns X98126


Statement
 

pdf   zip

html

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).

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

Input

Input consists of several cases. Each case consists of two positive integers: d (distance between the centers of two columns), r (the edge length of each column). You can assume that 2r < d, and that 1 ≤ d,r ≤ 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, a, b, c, d, e. 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 53 possible words, 33 consists of only wovels, which makes them illegible).

Public test cases
  • Input

    2 1
    7 2
    5 1
    0 0
    

    Output

    6
    12
    18
    
  • Information
    Author
    Eryk Kopczynski
    Language
    English
    Official solutions
    Unknown.
    User solutions