

Time Limit: 2 sec / Memory Limit: 1024 MB
配点 : 点
問題文
AtCoder では、ユーザーのレートは正の整数で与えられ、その値に応じて ^
がいくつか表示されます。
特に、レートが 以上 以下のときは次のようになります。
- レートが 以上 以下のときは
^
は 個表示される。 - レートが 以上 以下のときは
^
は 個表示される。 - レートが 以上 以下のときは
^
は 個表示される。 - レートが 以上 以下のときは
^
は 個表示される。
現在の高橋君のレートは です。ここで、 は 以上 以下の整数であることが保証されます。
表示される ^
の数を現在より増やすために、高橋君は少なくともレートをいくつ上げる必要があるか答えてください。
なお、本問題の制約下で、高橋君はレートを 以上に上げることなく ^
の数を増やすことができることが証明できます。
制約
- は整数
入力
入力は以下の形式で標準入力から与えられる。
出力
表示される ^
の数を現在より増やすために、高橋君は少なくともレートをいくつ上げる必要があるか整数で出力せよ。
入力例 1Copy
123
出力例 1Copy
77
高橋君の現在のレートは であり、^
は 個表示されています。
ここからレートを 上げると高橋君のレートは となり、^
は 個表示されるようになります。
レート が 以下のときは ^
の数は 個以下であるので、 を出力します。
入力例 2Copy
250
出力例 2Copy
50
Score : points
Problem Statement
In AtCoder, a user's rating is given as a positive integer, and based on this value, a certain number of ^
is displayed.
Specifically, when the rating is between and , inclusive, the display rules are as follows:
- When the rating is between and , inclusive,
^
is displayed once. - When the rating is between and , inclusive,
^
is displayed twice. - When the rating is between and , inclusive,
^
is displayed three times. - When the rating is between and , inclusive,
^
is displayed four times.
Currently, Takahashi's rating is . Here, it is guaranteed that is an integer between and , inclusive.
Find the minimum increase in rating required for him to increase the number of displayed ^
.
It can be proved that under the constraints of this problem, he can increase the number of ^
without raising his rating to or above.
Constraints
- is an integer.
Input
The input is given from Standard Input in the following format:
Output
Print, as an integer, the minimum increase in rating required for Takahashi to increase the number of displayed ^
.
Sample Input 1Copy
123
Sample Output 1Copy
77
Takahashi's current rating is , and ^
is displayed twice.
By increasing his rating by , his rating will become , and ^
will be displayed three times.
When the rating is or below, ^
is displayed not more than twice, so print .
Sample Input 2Copy
250
Sample Output 2Copy
50