Let be a positive integer. Bernardo and Silvia take turns writing and erasing numbers on a blackboard as follows: Bernardo starts by writing the smallest perfect square with digits. Every time Bernardo writes a number, Silvia erases the last digits of it. Bernardo then writes the next perfect square, Silvia erases the last digits of it, and this process continues until the last two numbers that remain on the board differ by at least 2. Let be the largest positive integer written on the board. What is the sum of the digits of ?
4583860
4583865
4583871
4583877
4583883