結果 : generating function approach