476C.md (1616B)
1 Source: https://codeforces.com/problemset/problem/476/C 2 3 C. Dreamoon and Sums 4 5 time limit per test 6 7 1.5 seconds 8 9 memory limit per test 10 11 256 megabytes 12 13 input 14 15 stdin 16 17 output 18 19 stdout 20 21 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*]. 22 23 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. 24 25 The answer may be large, so please print its remainder modulo 1 000 000 007 (109 + 7). Can you compute it faster than Dreamoon? 26 27 Input 28 29 The single line of the input contains two integers *a*, *b* (1 ≤ *a*, *b* ≤ 107). 30 31 Output 32 33 Print a single integer representing the answer modulo 1 000 000 007 (109 + 7). 34 35 Examples 36 37 Input 38 39 ``` 40 1 1 41 ``` 42 43 Output 44 45 ``` 46 0 47 ``` 48 49 Input 50 51 ``` 52 2 2 53 ``` 54 55 Output 56 57 ``` 58 8 59 ``` 60 61 Note 62 63 For the first sample, there are no nice integers because  is always zero. 64 65 For the second sample, the set of nice integers is {3, 5}.