Forward algorithm for hidden semi-Markov models with periodically varying transition probability matrices