51. Sum of Integers in a Range

Difficulty: easy · Math

Problem

Given two integers `m` and `n`, print the sum of all integers between them, including both ends. The two numbers may be given in either order.

Input

A single line containing two integers `m` and `n` separated by a space.

Output

Print the sum.

Example 1

Input:
0 3
Output:
6

Explanation: 0 + 1 + 2 + 3 = 6.

Example 2

Input:
5 2
Output:
14

Explanation: The order does not matter: 2 + 3 + 4 + 5 = 14.

Constraints

- 0 <= m, n <= 10^4

Solutions are judged against 2 sample and 10 hidden tests. Sign in to solve it · All problems