http://informatics.mccme.ru; problem 4; OK