Nth term of two mixed series

Two series are mixed term by term: the natural numbers 1, 2, 3, … and the squares 1, 4, 9, …, giving 1, 1, 2, 4, 3, 9, 4, 16, … Print the Nth term of the mixed series.

Reported in: TCS NQT (26 Apr 2024) (memory-based)

Input

One line: N.

Output

The Nth term.

Constraints

1 ≤ N ≤ 10^9.

Example 1

Input:
7

Output:
4

Example 2

Input:
8

Output:
16

Example 3

Input:
1

Output:
1

Hint: Odd positions hold the natural numbers and even positions the squares: for odd N the term is (N + 1) / 2, for even N it is (N / 2)².

All coding practice