Under construction

Still being built. Things may change

Cream Bread

Interview

Time limit1sMemory limit1024 MB

Summary
Count the groups of K consecutive loaves where the number of loaves without cream (0) is fewer than P.
Level

Easy2 of 10

Topics
Array, Implementation
Solved
No attempts yet

Problem

KOI Bakery sells bread filled with cream. The bakery made N×KN \times K loaves in total. KOI Bakery sells the loaves in a row, grouping them KK at a time from the front. That makes NN groups in total.

In a hurry, some loaves were made without cream. If a group has PP or more loaves without cream, the group cannot be sold. In other words, a group can be sold only when it has fewer than PP loaves without cream.

You are given whether each loaf has cream. Find the number of groups that can be sold.

Input

The first line contains NN, KK, and PP, separated by single spaces.

The second line contains integers separated by spaces, one per loaf, in order from the front. A 0 means the loaf has no cream, and a 1 means it has cream.

Output

Print the number of groups that can be sold on the first line.

Constraints

  • All given numbers are integers.
  • 1≤N≤501 \le N \le 50
  • 1≤K≤501 \le K \le 50
  • 1≤P≤K1 \le P \le K

Examples2

  1. Example 1

    Input
    2 3 2
    1 1 0 1 0 0
    
    Expected output
    1
    
  2. Example 2

    Input
    3 2 1
    1 1 0 0 1 1
    
    Expected output
    2