Hide

# Vudu

Young Mirko has been buying voodoo dolls lately. Considering that he is very interested in the cheapest purchase possible, he has been tracking the prices of voodoo dolls each day. His price list consists of doll prices in the last $N$ days, where doll price $a_ i$ represents the price of a doll $i$ days ago.

Mirko thinks he has noticed a connection between the average doll price in a sequence of consecutive days and the price on the following day. He wants to test his hunch and is puzzled by a very interesting question: “For a given $P$, how many different consecutive subsequences in the last $N$ days are there, when the average doll price was greater than or equal to $P$?”

Two consecutive subsequences are considered different if their beginnings or ends are different.

## Input

The first line of input contains the integer $N$, the sequence length ($1 \leq N \leq 1\, 000\, 000$). The second line of input contains $N$ prices $a_ i$ ($0 \leq a_ i \leq 1\, 000\, 000\, 000$). The third line of input contains an integer $P$. ($0 \leq P \leq 1\, 000\, 000\, 000$).

## Output

The first and only line of output must contain the answer to Mirko’s question for a given $P$.

Sample Input 1 Sample Output 1
3
1 2 3
3

1

Sample Input 2 Sample Output 2
3
1 3 2
2

5

Sample Input 3 Sample Output 3
3
1 3 2
3

1

CPU Time limit 4 seconds
Memory limit 1024 MB
Statistics Show