Jeremy loves geometry and counting. Unsurprisingly, he wants to do both at the same time!
On a Cartesian coordinate plane, Jeremy now draws a circle of radius R, centered at the origin. He wants to know how many lattice points have a distance no further than D units from the circumference of the circle he has just drawn. A lattice point on the Cartesian coordinate plane is a point with integer coordinates.
Jeremy can only draw small circles and count the points one by one. When R and D get large, he has no idea what the answer is. Help Jeremy!
The first and only line of input consists of two integers R and D.
For all input, 1 ≤ R ≤ 500000, 0 ≤ D ≤ 500000.
Output one single integer, the number of lattice points no further than D units from the circumference of a circle of radius R and centered at the origin.
Hint: Use 64-bit integers (Pascal: int64, C++: long long).
3 1
40
2 4
113
123456 78901
122406524248

Pictured is sample 1. The small dots indicate the lattice points that should be counted towards the answer.
| Название |
|---|


