Условие:

30999 + 1;
100001;
25909 + 1;
1000001.

30999 + 1 = 31000
 
100001 = 9999
 
25909 + 1 = 25910
 
1000001 = 99999