#B3876. Middle Element or Sum of Middle Elements
Middle Element or Sum of Middle Elements
Middle Element or Sum of Middle Elements
Given a positive integer \( n \), construct a sequence \( a \) of length \( n \) such that \( a_i=i \) for \( 1\le i\le n \).
If \( n \) is odd, output the middle element of \( a \) (i.e. the element at position \( \frac{n+1}{2} \)). Otherwise, if \( n \) is even, output the sum of the two middle elements (i.e. the sum of the elements at positions \( \frac{n}{2} \) and \( \frac{n}{2}+1 \)).
inputFormat
The input contains a single positive integer \( n \) (\( n \ge 1 \)).
outputFormat
Output a single integer which is either the middle element of the sequence if \( n \) is odd, or the sum of the two middle elements if \( n \) is even.
sample
1
1