Raising the Win Rate

Given total games X and wins Y, find the minimum extra consecutive wins needed to raise the floor(100*Y/X) displayed win rate, or report -1 if impossible.

Medium4MathBinary searchImplementationInterviewNo attempts yetTime limit2sMemory limit128 MB

Problem

A player has played X games and won Y of them.

The displayed win rate Z is computed as floor(100 * Y / X). In other words, the fractional part is discarded.

From now on, the player will win every additional game. Because the record is cumulative, each future game increases both the total number of games and the number of wins by 1.

Given X and Y, find the minimum number of additional games needed for the displayed integer win rate to increase.

Input

A single line contains two integers X and Y.

Output

Print the minimum number of additional games needed for the displayed win rate to increase. If it can never increase, print -1.

Constraints

  • 1 <= X <= 1,000,000,000
  • 0 <= Y <= X