Part of 2020 South Africa National Olympiad
Source: South African Mathematics Olympiad 2020, Problem 3