Doubt reagarding Piles again

Can you tell how to compute grundy number for any state in this question ??

please help this question game theory 3 , how to calculate grundy number