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

~/algor $ cat problems/birdan-n-gacha-yigindi

Sum from 1 to n

Easy 1000 ms 64 MB 8%
Share

A positive integer $n$ is given. Find the sum of all positive integers from $1$ to $n$:

$$1 + 2 + \ldots + n$$

A staircase of columns of height 1, 2, ..., n; the total number of cells is the answer

Input

One positive integer $n$.

Output

One integer — the sum.

Note

$1 \le n \le 10^{9}$

Examples

Input #1
5
Output #1
15
Input #2
1
Output #2
1

Sign in to submit a solution

Signing up is free and takes a minute.