P28080 [洛谷] [Lanqiao Cup 2024 National Senior Group] Math Problem
入门
题目描述

Problem Description

Calculate $\sum\limits_{i=1}^n{\sum\limits_{j=1}^m{|f(ij)|}}$, where $|f(x)|$ is $1$ if $x$ is a perfect square, otherwise it is $0$.

Input Format

The input consists of a single line containing two positive integers separated by a space, representing $n$ and $m$ as described in the problem.

Output Format

Output a single line containing a positive integer, which is the answer to the problem.

Hint: The data guarantees that the answer will not exceed the range of unsigned long long.

Sample Input and Output

Sample Input #1

2 3

Sample Output #1

2

Sample Input #2

1000000000 1000000000

Sample Output #2

12735999860

Notes

  • For $15\%$ of the test cases, $n, m \le 10^5$;
  • For $30\%$ of the test cases, $n \le 10^7$, $m \le 10^9$;
  • For $50\%$ of the test cases, $n, m \le 10^{11}$;
  • For $70\%$ of the test cases, $n, m \le 10^{15}$;
  • For all test cases, $1 \le n, m \le 1.5 \times 10^{16}$.

Thanks to @ACaCaca_ for providing the data.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
2 3
样例输出
2