#K61372. Sum of Even or Odd Numbers

    ID: 31295 Type: Default 1000ms 256MiB

Sum of Even or Odd Numbers

Sum of Even or Odd Numbers

You are given a positive integer N. Your task is to compute the sum of numbers from 1 to N based on the following rule:

  • If N is even, calculate the sum of all even numbers in the range [1, N].
  • If N is odd, calculate the sum of all odd numbers in the range [1, N].

For example, if N = 10 (even), the even numbers between 1 and 10 are 2, 4, 6, 8, 10 and their sum is 30. Similarly, if N = 7 (odd), the odd numbers between 1 and 7 are 1, 3, 5, 7 and their sum is 16.

Note: Input will be provided via standard input (stdin) and the output must be produced on standard output (stdout). Use appropriate algorithms to ensure your solution meets the performance requirements.

inputFormat

The input consists of a single integer N (1 ≤ N ≤ 106) provided via standard input.

outputFormat

Output a single integer representing the sum as per the described rule.

## sample
10
30