Added bug which minuses 1 from number

if result of the calculation is in the range 10000 to 1000000.
Added tests for this bug and the overflow bug