#C8282. Sum of Integers in a Range
Sum of Integers in a Range
Sum of Integers in a Range
Given two integers \( a \) and \( b \), your task is to compute the sum of all integers between \( \min(a, b) \) and \( \max(a, b) \) inclusive. In other words, if \( a \) and \( b \) are not in order, first reorder them and then sum all the integers in the range. Use the arithmetic progression sum formula: \( S = \frac{n(a_1 + a_n)}{2} \), where \( n \) is the number of terms.
inputFormat
Input: Two space-separated integers \( a \) and \( b \).
outputFormat
Output: A single integer which is the sum of all integers from \( \min(a, b) \) to \( \max(a, b) \) (inclusive).
## sample1 3
6