#B4190. Equal Pizza Slices

    ID: 11847 Type: Default 1000ms 256MiB

Equal Pizza Slices

Equal Pizza Slices

On Taotao's birthday, she wants to share a circular pizza with n friends and herself, making n+1 people in total. She wishes to divide the pizza into n+1 slices that are identical in size and shape. All cuts must be made as straight lines and the pizza cannot be stacked when cutting.

To get n+1 equal slices, consider the following approach: Let k = n+1. When k==1 no cut is needed. If k is even, you can make k/2 cuts. These cuts, each passing through the center, yield 2 slices per cut. If k is odd (and k > 1), you must perform k radial cuts, each from the center to the edge, to obtain k equal sectors.

Mathematically, the minimum number of cuts required is given by:

\[ \text{ans} = \begin{cases} 0, & \text{if } k=1;\\ \frac{k}{2}, & \text{if } k\text{ is even};\\ k, & \text{if } k\text{ is odd and } k>1. \end{cases} \]

Your task is to compute this minimum number of straight cuts.

inputFormat

The input consists of a single integer n (0 ≤ n ≤ 109), representing the number of friends Taotao has.

outputFormat

Output a single integer, the minimum number of straight cuts required to slice the pizza into n+1 equal pieces.

sample

1
1