Optimal game strategy 1

can u pls explain the sample output? how 6 is coming