Part of 2010 Finnish National High School Mathematics Competition
Source: Finnish Mathematics Competition 2010, Final Round, Problem 3