Sum of First N Natural NumbersEasy

Sum of First N Natural Numbers

EasyPractice library · +10 XPrecursion

Write a program that computes the sum of the first N natural numbers (1 + 2 + 3 + ... + N).

Input

A single integer N on a line.

Output

A single integer representing the sum of the first N natural numbers.

Constraints

1 <= N <= 1000

Time limit 1 s (native code; slower languages get more)Memory 256 MB11 hidden tests

Example 1

Input
5
Output
15

The sum of the first 5 natural numbers (1+2+3+4+5) is 15.

Example 2

Input
10
Output
55

The sum of the first 10 natural numbers (1+2+...+10) is 55.

Hints