#K73517. Nth Triangular Number

    ID: 33993 Type: Default 1000ms 256MiB

Nth Triangular Number

Nth Triangular Number

You are given a positive integer n. Your task is to compute the nth triangular number, which is defined as the sum of the first n natural numbers. The formula for the nth triangular number is given by:

\( T_n = \frac{n(n+1)}{2} \)

For example, if n = 4, then the triangular number is 10 because 1 + 2 + 3 + 4 = 10.

Your program should take input from standard input (stdin) and output the result to standard output (stdout).

inputFormat

The input consists of a single integer n (\(1 \le n \le 10^9\)).

outputFormat

Output the nth triangular number computed using the formula \( T_n = \frac{n(n+1)}{2} \).

## sample
1
1