Посмотрите в Рябушко
http://www.reshebnik.ru/solutions/1/10/
http://www.reshebnik.ru/solutions/1/12