#P4050. Necklace

Necklace

Description

Input

Output

Source