Question 29
Answer-format rule: round a non-integer result to the nearest integer. If the calculated answer has more than five digits, give its last five digits.
Two players fill a row of ten squares with marbles. They alternate turns; each turn places between one and five marbles, starting at the leftmost empty square and continuing without gaps. The player who places the last marble loses. Example: A starts by placing 2, B places 3, A places 2, B places 2, then A must fill the only remaining square and loses. The four intermediate rows are shown. If the row instead has 40 squares, how many marbles should the first player place on turn 1 to guarantee a win?

Two players fill a row of ten squares with marbles. They alternate turns; each turn places between one and five marbles, starting at the leftmost empty square and continuing without gaps. The player who places the last marble loses. Example: A starts by placing 2, B places 3, A places 2, B places 2, then A must fill the only remaining square and loses. The four intermediate rows are shown. If the row instead has 40 squares, how many marbles should the first player place on turn 1 to guarantee a win?
