SSR

Count ordered pairs (A, B) with A <= N and B <= M for which (sqrt(A) + sqrt(B))^2 is an integer.

Medium7Number theoryMathCombinatoricsImplementationNo attempts yetTime limit2sMemory limit512 MB

Problem

For two positive integers AA and BB, define SSR(A,B)=(A+B)2\mathrm{SSR}(A, B) = (\sqrt{A} + \sqrt{B})^2.

Given two integers NN and MM, write a program that counts the ordered pairs (A,B)(A, B) with 1AN1 \le A \le N and 1BM1 \le B \le M for which SSR(A,B)\mathrm{SSR}(A, B) is an integer.

Input

The first line contains NN and MM, separated by a space. (1N,M777771 \le N, M \le 77777)

Output

Print the number of ordered pairs (A,B)(A, B) that satisfy the condition on the first line.