in the Man High Castle world m different film ending Abendsen own storage shelf at n order film shelf in ith month empty storage Put k_i cdot m film storage k_i film end he think question put film shelf storage randomly pick n film film storage rearrange shelf probability sequence ending l_i r_i shelf change Notice think question shelf actually changedanswer abendsen questionslet probability fraction p_i Lets total number way n film storage ith month A_i P_i cdot A_i integer Print month P_i cdot A_i pmod 998244353998244353 prime number equal 119 cdot 223 1it guarantee 100 different k value