codeforces-scrape

Codeforces scraped problems and editorials
git clone git://git.laack.co/codeforces-scrape.git
Log | Files | Refs | README

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 ![](https://espresso.codeforces.com/747b668d05dce59a14c79f7573cf84d4af25536c.png) and ![](https://espresso.codeforces.com/f2c3c9a716cef71591af317f816d0d89605de8cd.png), where *k* is some integer number in range [1, *a*].
     22 
     23 By ![](https://espresso.codeforces.com/1e6fb3a33a9e71aae77ea40b847b4751cad6a9b2.png) we denote the quotient of integer division of *x* and *y*. By ![](https://espresso.codeforces.com/13ccd3404ca33681bef79230f269517728677a3a.png) 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 ![](https://espresso.codeforces.com/03b1dc6bae5180f8a2d8eb85789e8b393e585970.png) is always zero.
     64 
     65 For the second sample, the set of nice integers is {3, 5}.