Public submissions
Source code of every submission to this problem in this contest will be visible for everyone since 2013-08-26 12:38:07.

SMPSUM - Iterated sums

Please compute the sum of squares for the given numbers: a, a+1, ..., b-1, b.

Input

Two numbers: a and b separated by space, where 1 <= a <= b <=100.

Output

Computed sum: a*a + (a+1)*(a+1) + ... + (b-1)*(b-1) + b*b

Example

Input:
1 4

Output:
30

Example 2

Input:
5 6

Output:
61

Added by:kuszi
Date:2013-08-26
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64
Public source code since: 2013-08-26 12:38:07

hide comments
2013-12-27 00:02:48 kuszi
@Tarun yes, the appropriate statement has been added to the problem description. Thank you for the comment.
2013-12-26 12:50:00 Tarun
in the input are the two values seperated by a space?
2013-12-16 14:17:57 Samil Vargas
i hope do it with gauus sum.
2013-08-26 10:52:04 kuszi
Are you able to compute the sum without iterations?
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.