Mode Coupling And Degeneracy Condition In Multilayer Waveguide Structure With Grating