#P1829. [国家集训队] Crash的数字表格 / JZPTAB
[国家集训队] Crash的数字表格 / JZPTAB
Description
In today's math class, Crash learned about the Least Common Multiple. For two positive integers and , denotes the smallest positive integer divisible by both and . For example, .
After returning home, Crash was still thinking about what he learned. To study the Least Common Multiple, he drew an table. Each cell contains a number, where the cell in the -th row and -th column contains .
Looking at this table, Crash thought of many questions. The one he most wants to solve is very simple: what is the sum of all the numbers in this table? When and are large, Crash cannot handle it, so he asks you to write a program to compute the answer. Since the result can be very large, Crash only wants the sum modulo .
Input Format
The input contains one line with two integers and .
Output Format
Output one positive integer, the sum of all numbers in the table modulo .
4 5
122
Hint
Sample 1 Explanation:
The table is:
Constraints:
- For of the testdata, .
- For of the testdata, .
- For of the testdata, .
Translated by ChatGPT 5
京公网安备 11011102002149号