On a board, the numbers from 1 to 2009 are written. A couple of them are erased and instead of them, the remainder of the sum of the erased numbers divided by 13 is written on the board. After a few repetitions of this process, only three numbers are left, of which two are 9 and 999. Find the third number.

Let's think step by step and output the final answer within \boxed{}.
user