Dynamical energy transfer in ac-driven quantum systems