electicode
HomeCoursesResourcesProblemsNational OlympiadContestsLeaderboard
...

Arithmetic sum

Time Limit: 1000msMemory Limit: 256MB
View Submissions

Problem Description

Write a program that sums all integers from 1 to N.

SubtaskPointsAdditional Constraints
1401≤n≤1031 \leq n \leq 10^31≤n≤103
2601≤n≤1091 \leq n \leq 10^91≤n≤109

Input Format

The program is given one integer n(1≤n≤109)n (1 \leq n \leq 10^9)n(1≤n≤109).

Output Format

Output one integer - the sum of all numbers from 1 to nnn.

Examples

Example 1
Input
5
Output
15

© 2026 Electicode. All rights reserved.