Descriptions:

Santa Claus and a Palindrome

CodeForces - 748D