#P9049. [PA 2021] Mopadulo

[PA 2021] Mopadulo

Problem Description

Given a sequence aa of length nn, find how many ways there are to divide aa into several intervals, such that for every interval, the sum of all numbers in this interval modulo 109+710^9 + 7 is even.

Since the answer may be very large, you only need to output the value of the answer modulo 109+710^9 + 7.

Input Format

The first line contains an integer nn.

The second line contains nn integers a1,a2,,ana_1, a_2, \cdots, a_n.

Output Format

One line containing an integer, representing the required value.

4
1000000006 1 5 1000000004
3

Hint

Sample #1 Explanation

The three ways to divide are as follows.

  • [1,4][1, 4]
  • [1,2],[3,4][1, 2], [3, 4]
  • [1],[2,3],[4][1], [2, 3], [4]

Constraints

For all testdata, 1n3×1051 \leq n \leq 3 \times 10^5, 0ai<109+70 \leq a_i < 10^9 + 7.

Translated by ChatGPT 5