Siyam’s Birthday Cake
Time Limit: 0.5 sec
The Problem
Do you know Siyam? He is a giant of level 7 in Clash of clans. :p But he is a good guy . Guess what! Its Siyam’s Birthday today! Siyam’s friends are here. They bought him a cake. The Cake is circle shaped. Siyam is very bad at distributing, and is very greedy about food. He will just cut a straight lined portion for a friend, so N friends means the cake will be cut by N straight lines. So there will be many cake pieces .But out of the cake pieces he will distribute equally among him and his friends . And all the rest will be added to his portion(if any). Means everyone will get same number of pieces except him.
Now your job is to write a program to find how many pieces of cake Siyam will have.
The above picture shows three straight cuts for three Siyams friends.
The Input
There are several lines in the input file. In each line of input you will be given an integer N (0≤N≤210000000) the number of Siyam’s friend. Negative input terminates the program.
The Output
For each N you have to output the number of pieces Siyam will have in a single line.
Sample Input
3
5
7
23213123
-3
Sample Output
4
6
8
23213124
Online Practice Contest 4 [School & College Level]
Problem Setter: Eftekher Ahmed Aqib