14887 - Scratcher Ticket   

Description

Given multiple rounds of a game, you are required to calculate the final balance of a player. In each round, three integers are provided: the player's value A, the dealer's value B, and the prize amount P.

The rules for each round are as follows:

  • If the player's value is greater than the dealer's value, the player wins the prize amount.

  • If the player's value is less than the dealer's value, the player loses the prize amount.

  • If both values are equal, no money is won or lost.

The player starts with a balance of 10,000. If the player's balance drops to 0 or becomes negative at any point, the game must stop immediately. In this case, output with '\n' for the current round. For all subsequent rounds, no matter what happens, output "No balance" with '\n' for each input line. If the player survives all rounds, just output the final balance with '\n'.

Constraints

0 <= A <= 109

0 <= B <= 109

0 <= P <= 1016

 

Input

There are multiple lines. Each contains three integers: A (player), B (dealer), and P (prize).

Output

If the player survive all rounds, then just output a single integer representing the total accumulated balance, followed by a newline character.

If the player's balance drops to 0 or becomes negative at any point, output with '\n' for the current round. For all subsequent rounds, output "No balance" with '\n' for each input line.

Sample Input  Download

Sample Output  Download

Tags




Discuss