#B4109. JOI’s Walk

    ID: 11766 Type: Default 1000ms 256MiB

JOI’s Walk

JOI’s Walk

JOI is taking a walk along a straight road. He alternates between the following two operations:

  • Moving forward by 3 m
  • Moving backward by 2 m

JOI starts at position 0. Given an integer X representing the number of operations performed, determine his final position.

The process can be formulated as follows:

$$\text{position} = 3 \times \lceil \frac{X}{2} \rceil - 2 \times \lfloor \frac{X}{2} \rfloor$$

Note that the 1st, 3rd, 5th ... moves are forward moves and the 2nd, 4th, 6th ... moves are backward moves.

inputFormat

The input consists of a single integer X (1 ≤ X ≤ 109) representing the number of operations.

outputFormat

Output a single integer representing JOI's final position after X operations.

sample

1
3