A printing company agreed to publish a book about Western history. When they were numbering the pages of the book, they noticed that they used 2989 digits. How many pages long was the book they agreed to publish?