409030: GYM103416 J Replace by sum

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

J. Replace by sumtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

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.

Input

The 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$$$).

Output

In 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$$$.

ExamplesInput
5
4 3 1 2 8
2
8 10
Output
1
2 
Input
8
4 9 1 5 3 1 2 4
2
14 15
Output
2
2 3 
Input
3
3 9 1
2
10 11
Output
0

加入题单

上一题 下一题 算法标签: