Part of 2007 Bulgarian Autumn Math Competition
Source: 2007 Bulgarian Autumn Math Competition, Problem 8.3