CF476C.Dreamoon and Sums

普及/提高-

通过率:0%

时间限制:1.50s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Dreamoon loves summing up something for no reason. One day he obtains two integers a and b occasionally. He wants to calculate the sum of all nice integers. Positive integer x is called nice if and , where k is some integer number in range [1, a].

By we denote the quotient of integer division of x and y. By we denote the remainder of integer division of x and y. You can read more about these operations here: http://goo.gl/AcsXhT.

The answer may be large, so please print its remainder modulo 1 000 000 007 (109 + 7). Can you compute it faster than Dreamoon?

Dreamoon 喜欢毫无理由地求和。某天,他偶然得到了两个整数 aa 和 bb。他希望计算所有“优美整数”(nice integers)的和。正整数 xx 被称为优美整数,当且仅当

且
,
其中 kk 是区间 [1, a][1,\,a] 内的某个整数。

我们用 表示 xx 与 yy 的整数除法的商,用 表示 xx 与 yy 的整数除法的余数。关于这些运算的更多说明,请参见:http://goo.gl/AcsXhT。

答案可能很大,因此请输出其对 1 000 000 0071\,000\,000\,007(即 109+710^9 + 7)取模的结果。你能比 Dreamoon 更快地算出它吗?

输入格式

The single line of the input contains two integers a, b (1 ≤ a, b ≤ 107).

输入仅包含一行,其中有两个整数 aa、bb(1 ≤ a, b ≤ 1071 ≤ a, b ≤ 10^7)。

输出格式

Print a single integer representing the answer modulo 1 000 000 007 (109 + 7).

输出一个整数,表示答案对 1 000 000 007(即 109+710^9 + 7)取模的结果。

输入输出样例

  • 输入#1

    1 1

    输出#1

    0
  • 输入#2

    2 2

    输出#2

    8

说明/提示

For the first sample, there are no nice integers because is always zero.

For the second sample, the set of nice integers is {3, 5}.

对于第一个样例,不存在“好整数”,因为 恒为零。

对于第二个样例,“好整数”的集合为 {3, 5}。

输入解题思路,AI测评打分。不知道怎么写?

首页