образец

http://www.reshebnik.ru/solutions/3/1/