ENG  RUSTimus Online Judge
Online Judge
Online contests
About Online Judge
Frequently asked questions
Site news
Problem set
Submit solution
Judge status
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests

Ural Championship 2012

About     Problems     Submit solution     Judge status     Standings
Contest is over

H. Coffee and Buns

Time limit: 1.0 second
Memory limit: 64 MB
Planet Ataraxia is known for its education centers. The people who are expected to take high social positions in future are brought up in conditions of continuous training and supervision from the early age. Each education center is a small town with all the necessary utilities. During the construction of a center, a square area is chosen which is divided into equal sections each sized 100 × 100 meters. In each of these sections they build one building, which would become residential or academic. The outer perimeter of the center is fenced.
After a successful military operation in the Andromeda nebula the active colonization of habitable planets has started. The need for people able to take command and lead people to the new worlds has increased. Therefore, two new education centers should be built on Ataraxia. Discussion about the details of the project in the local administration is already underway for many days. During this time it was decided that the first center will consist of a2 sections and that the second one will consist of no more than n2 sections. The situation is complicated because, according to requirements of the antimonopoly legislation, construction works must be performed by at least two different companies, each of them must build an equal number of buildings and an equal number of 100-meters segments of the fence.
You are responsible for resupplying the administration office. You understand that while they are discussing the pros and cons of each possible size of the second center a lot of buns and coffee will be consumed, and it's time to buy them. So you'd like to know how many different sizes of the second center will meet the requirements of antimonopoly legislation and, therefore, will be fully considered by the administration.


The only line contains integers a and n (1 ≤ a ≤ 1012; 1 ≤ n ≤ 1018).


Output an amount of different sizes of the second center meeting the requirements of antimonopoly legislation.


3 6


In this example it is possible to build the second center sized 3 × 3 or 6 × 6, delegating the construction to three different companies, or to build it sized 1 × 1 or 5 × 5, delegating the construction to two different companies.
Problem Author: Ivan Burmistrov
Problem Source: Ural Championship 2012
To submit the solution for this problem go to the Problem set: 1907. Coffee and Buns