Added task 3. Sergey Ponomarev