Problems
10012 - ATM

ATM

Time Limit: 1 sec

The Problem

Nowadays, ATM (Automated Teller Machine) is very popular. People do not like to carry cash money rather like to carry ATM Card.

ATM only accepts the transaction if withdrawal amount is a multiple of 100 BDT and the customer has enough account balance to perform the transaction. There are always 100 BDT, 500 BDT and 1000 BDT notes available in the ATM cash drawer. ATM chooses the highest valued note earlier than lower values. For example, an account holder wants to withdraw 2700 BDT from ATM. His/her bank account balance is 5000 BDT. So he/she will get 5 notes (2 notes of 1000 BDT, 1 notes of 500 BDT and 2 notes of 100 BDT).

Now write a program that will calculate the number of notes needed for a valid withdrawal/transaction.

The Input

The input consists of several test cases. In each test case, there are 2 numbers as W (withdrawal amount) and B (balance of bank account), 0 < W < 1000000, 0 <B < 1000000. Input is terminated by EOF.

The Output

For each line of input, print the number of notes that an account holder will get for a valid transaction. For invalid transaction, print Invalid Transaction in a separate line.

Sample Input

2700 5000

2450 6000

900 1500

700  500

Sample Output

5

Invalid Transaction

5

Invalid Transaction

[School Level]

Inter School & College Programming Contest (ISCPC) 2015

Problem Setter: Md. Helal Uddin & Hasnayn Ahmed Shakil