FFT lets you do the following:
You are given two sequences: a0,...,an and b0,...,bm Compute sequence c0,…,c[n+m] such that
This is exactly what I needed here, where and . If I thought for a little longer I would realize that instead of computing it using FFT.
§ References
- [Codeforces contest comment by Swistakk) [https://codeforces.com/blog/entry/85348?#comment-730898 ]