Wow, such templates, very algorithm