Exact solution for square-wave grating covered with graphene: surface plasmon-polaritons in the terahertz range