Practice on Toph

Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.

Think Positive

Limits: 1s, 1.0 GB

The greatest thieves of the Universe Tuki and Zha are finally captured and to punish them the science council has admitted them to ${Num Bolbo Na}$ University. At first, Tuki and Zha couldn’t understand how this can be a punishment! But after few months are gone, they have realized they are trapped here forever because, courses are limited and the number of students keeps increasing at an enormous rate. The Chairman is even restricting the number of courses each students can take. But Tuki and Zha want to get out of it as fast as possible!

Their intelligent robot friend Robi couldn’t bear the sadness of Tuki and Zha, so after enormous efforts, it has managed to hack into the advising system of the University and found the following line of code:

Here, X denotes the maximum possible number of courses Tuki and Zha can advise, N denotes the number of students who are going to do the advising excluding Tuki and Zha and M is any integer number.

Tuki and Zha have no idea about the number of students who are going to do the advising. Hence they don’t know the exact value of N. They only know that, there’s at least one student who’ll do the advising excluding them. But they have got the access to change the value of M, which can be any integer number. Now they want to set the value of M to an integer number such that the code will always allocate the maximum possible number of courses for Tuki and Zha no matter how many students do the advising. But they are thieves, not mathematicians. So they are asking for your help.

So you need to find a constant integer value of M such that, for any positive value of N, X will always become the largest possible integer number.

If you are not familiar with the modulo(referred as mod) operation, it finds the remainder after division of one number by another. Given two positive numbers, ${a}$ (the dividend) and ${n}$ (the divisor), $({a \mod n})$ is the remainder of the Euclidean division of ${a}$ by ${n}$. In most of the programming languages the modulo operator is denoted by % symbol. So to calculate $({a \mod n})$, we generally use $({a}$ % ${b})$ in our code.

For example, the expression $({5 \mod 2})$ would evaluate to ${1}$ because ${5}$ divided by ${2}$ leaves a quotient of ${2}$ and a remainder of ${1}$, while $({9 \mod 3})$ would evaluate to ${0}$ because the division of ${9}$ by ${3}$ has a quotient of ${3}$ and leaves a remainder of ${0}$ as there is nothing to subtract from ${9}$ after multiplying ${3}$ times ${3}$. (Source: Wikipedia)

It also works when ${n}$ is a positive number but ${a}$ is negative. In that case the result of $({a \mod n})$ is basically $(((a \mod n) + n) \mod n)$. For example, the result of $(-5 \mod 8)$ can be evaluated in the following way.

(-5 % 8)
= (((-5 % 8) + 8) % 8)
= ((-5 + 8) % 8)
= ((3 + 8) % 8)
= 3


There’s no input in this problem.


A single integer representing the constant value of M.

The output is incorrect. It has been given in the sample output just to show you the correct procedure. You have to print the correct answer.