Solution for problem [Candy]