We know light speed (average) gets slow while in transparent materials like glass and water. And fraction of it gets absorbed as a heat (K.E. of molecules of glass). But my question is that How it can then leaving glass slab or any glass material comes to it's normal speed again? If light is absorbed in the material as heat then some light energy must be lost there, and after emanating from denser (glass) to back rare (air) where does this compensation of "speed" and energy comes from?