409030: GYM103416 J Replace by sum
Description
You are given two arrays of integers $$$a$$$ and $$$b$$$.
You can perform the following operation on the array $$$a$$$:
1. Pick some subarray of length k.
2. Replace it with the sum of the elements in the subarray.
For example, if the initial array was $$$[3, 6, 9]$$$ and we have $$$k$$$ = 2, then in a single operation you can replace the last two elements by their sum, yielding an array $$$[3, 15]$$$, or replace the first two elements to get an array $$$[9, 9]$$$.
For some fixed $$$k$$$, let us denote it as valid, if it is possible to get the array $$$b$$$ from $$$a$$$ by performing the given operation some number of times (possibly zero).
Find the valid values of $$$k$$$ ($$$1 \le k \le n$$$) and print them in an increasing order.
InputThe first line contains an integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the size of array $$$a$$$.
The second line contains $$$n$$$ integers — the elements of array $$$a$$$ ($$$1 \le a_i \le 10^9$$$).
The third line contains an integer $$$m$$$ ($$$1 \le m \le 2 \cdot 10^5$$$) — the size of array $$$b$$$.
The fourth line contains $$$m$$$ integers — the elements of array $$$b$$$ ($$$1 \le b_j \le 10^9$$$).
OutputIn the first line print one integer $$$p$$$ ($$$0 \le p \le n$$$) - the number of valid values of $$$k$$$.
In the second line print $$$p$$$ integers - valid values of $$$k$$$.
ExamplesInput5 4 3 1 2 8 2 8 10Output
1 2Input
8 4 9 1 5 3 1 2 4 2 14 15Output
2 2 3Input
3 3 9 1 2 10 11Output
0