Count ordered pairs (A, B) with A <= N and B <= M for which (sqrt(A) + sqrt(B))^2 is an integer.
For two positive integers AAA and BBB, define SSR(A,B)=(A+B)2\mathrm{SSR}(A, B) = (\sqrt{A} + \sqrt{B})^2SSR(A,B)=(A+B)2.
Given two integers NNN and MMM, write a program that counts the ordered pairs (A,B)(A, B)(A,B) with 1≤A≤N1 \le A \le N1≤A≤N and 1≤B≤M1 \le B \le M1≤B≤M for which SSR(A,B)\mathrm{SSR}(A, B)SSR(A,B) is an integer.
The first line contains NNN and MMM, separated by a space. (1≤N,M≤777771 \le N, M \le 777771≤N,M≤77777)
Print the number of ordered pairs (A,B)(A, B)(A,B) that satisfy the condition on the first line.