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