Source: https://www.mathador.fr/pdf/2016/Exemples_Solution_Concours_2016.pdf