"Long" arithmetic


Plus
Pin


Problem description Progress
ID 38474. Even-odd
Темы: Binary search by answer    "Long" arithmetic   

Given an increasing sequence of integers 1, 2, 4, 5, 7, 9, 10, 12, 14, 16, 17, ... It is formed as follows: one odd number is taken, then two even ones, then three odd ones, and so on . Output the N-th element of this sequence.

Input
One integer N (1 ≤ N ≤ 10100).

Imprint
Print one integer - the N-th element of the sequence.

Examples
# Input Output
1 1 1
2 4 5