Under construction

Still being built. Things may change

Raising the Win Rate

Interview

Time limit2sMemory limit128 MB

Summary
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.
Level

Medium4 of 10

Topics
Math, Binary search, Implementation
Solved
No attempts yet

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

Examples5

  1. Example 1

    Input
    10 8
    
    Expected output
    1
    
  2. Example 2

    Input
    100 80
    
    Expected output
    6
    
  3. Example 3

    Input
    47 47
    
    Expected output
    -1
    
  4. Example 4

    Input
    99000 0
    
    Expected output
    1000
    
  5. Example 5

    Input
    1000000000 470000000
    
    Expected output
    19230770