Source: https://www.imo-official.org/problems/IMO2008SL.pdf