Mikhail Tsarev lab1

Also it would be better to add test for this.