Skip to main content
Tuesday (24.11.2026) at 20:00: ALGOR Contest: Round #4 (Special Challenge) starts!

~/algor $ cat problems/a-dan-b-gacha-yigindi

Sum from A to B

Easy 1000 ms 64 MB 23%
Share

Two integers $A$ and $B$ are given ($A \le B$). Compute the sum of all integers from $A$ to $B$:

$$S = A + (A + 1) + \dots + B$$

The sum of consecutive numbers

Input

One line with two integers: $A$ and $B$.

Output

One integer — the sum.

Note

$-10^{5} \le A \le B \le 10^{5}$

Examples

Input #1
1 5
Output #1
15
Input #2
3 8
Output #2
33

Sign in to submit a solution

Signing up is free and takes a minute.