Under construction

Still being built. Things may change

Great Comebacks

Time limit2sMemory limit1024 MB

Summary
Given the final powerful strike counts of Thor and Hulk, find the largest possible number of times a trailing fighter goes on to lead.
Level

Medium4 of 10

Topics
Math, Implementation
Solved
No attempts yet

Statement

Thor and Hulk fight to the death. One powerful strike follows another. The crowd is thrilled!

The Grandmaster watches the fight. He does not root for either fighter. He cares about the spectacle, so after the fight he wants to rate how exciting it was. He counts every powerful strike by each fighter, then counts the comebacks during the fight. A comeback happens when a fighter who was trailing in the count of powerful strikes goes on to lead.

The Grandmaster kept only the final score and cannot reconstruct the number of comebacks. He liked the fight so much that he assumes the number of comebacks was the largest possible. Given the final score, find that maximum number of comebacks.

Input

A single line with two integers aa and bb separated by a colon (:). aa is the number of powerful strikes by Thor, and bb is the number of powerful strikes by Hulk (0≤a,b≤10000 \le a, b \le 1000).

Output

Print one integer, the largest possible number of comebacks in the fight.

Hint

In the first example, Thor gave Hulk no chance to strike, so no comebacks are possible.

In the second example, Hulk strikes first, then takes two strikes from Thor, and then finishes him with six strikes in a row. So Hulk leads first, Thor makes a comeback, and then Hulk takes the lead back.

Examples2

  1. Example 1

    Input
    5:0
    
    Expected output
    0
    
  2. Example 2

    Input
    2:7
    
    Expected output
    2