I now realize that I must always keep the result of each subtraction as a four-digit number. The trap I fell into was 1000 - 0001 = 999 instead of 0999. :-(

Thanks again!

Aziz Inan