Swedish coins (2)

The statement of this problem is similar to the previous one. But here,
you must solve a different problem:

Given a collection of coins C, how many subsets S of C are such that
w(S) = 1/2?

Input

Input consists of several cases, each one with n followed by p₁…p_(n).
Assume 1 ≤ n ≤ 10⁵ and 0 < p_(i) < 1.

Output

For every case, print the number of subsets S such that w(S) = 1/2.
Since this number can be huge, compute it modulo 10⁸ + 7.

Problem information

Author: Salvador Roura

Generation: 2026-01-25T10:08:27.574Z

© Jutge.org, 2006–2026.
https://jutge.org
