Someone Gets Hurt


Submit solution

Points: 1
Time limit: 2.0s
Memory limit: 256M

Problem type

Janis and Damien are furious with Cady, after discovering she lied about being busy just to throw a "Revenge Party". Now they're confronting her.

Cady is standing at a roundabout. Janis and Damien are in their car, directly across from her. Damien begins driving around the roundabout at a constant speed, completing 1 full loop per minute. Janis stands through the sunroof, shouting her lecture down at Cady.

Janis wants her words to hit hard. She considers a sentence to be "powerful" if she finishes saying it exactly when the car is directly across from Cady — in other words, when Damien completes a full number of loops.

Here are the rules:

  • Janis reads her lecture sentence by sentence, in order.
  • A sentence consists of a sequence of words ending in a period (.).
  • Once she starts a sentence, she cannot stop until it's finished.
  • However, she can wait before starting a sentence, to time it just right.
  • Janis speaks at a fixed rate of s words per loop.
  • Damien can only drive for t loops before breaking his curfew.

Janis wants to finish her lecture with as many "powerful" sentences as possible, without breaking Damien's curfew.

Input

The first line consists of an integer n (1 \leq n \leq 10^5), the number of words in Janis' lecture.

The second line consists of an integer s (0 \leq s \leq 500), the number of words Janis can say in one revolution.

The third line consists of an integer t (0 \leq t \leq 500), Damien's maximum number of revolutions.

The fourth line contains Janis' entire lecture, a series of n words. Sentences are separated by full stops, and there is no other punctuation. There are at most m (1 \leq m \leq 500) sentences in Janis' lecture. Each word is no more than 10 characters long. For example, the lecture "This is one. This is two." contains 2 sentences with 3 words each.

Output

Output the maximum number of sentences Janis can finish when she is directly across from Cady (her starting point), while completing her speech and preserving Damien's curfew.

If it's not possible for Janis to complete her speech in time, output -1.

Clarifications

  • The only characters in Janis' speech are English letters, spaces and full stops.

Example

Input 1
25
10
3
Buddy its not pretend. You are as plastic as they come. You think your shit dont stink. You think the rest of us are dumb.
Output 1
2

Janis' lecture has 25 words, broken into 4 sentences:

  • "Buddy, its not pretend.": 4 words
  • "You are as plastic as they come.": 7 words
  • "You think your shit dont stink.": 6 words
  • "You think the rest of us are dumb.": 8 words

Her speaking speed is 10 words per minute and Damien can drive for a maximum of 3 loops.

The optimal way to deliver her speech is as follows:

  • Sentence 1 (4 words): Janis starts immediately. The car has now completed 0.4 loops, so this sentence is not powerful.
  • Sentence 2 (7 words): She starts immediately after the first. The car has now completed 1.1 loops, so this sentence is not powerful.
  • Sentence 3 (6 words): Janis waits until the car is 1.4 loops around, then starts. The car has now completed exactly 2.0 loops, so this sentence is powerful.
  • Sentence 4 (8 words): Janis waits until the car is 2.2 loops around, then starts. It takes 0.8 minutes. The car has completed exactly 3.0 loops, so this sentence is powerful.

Janis has finished her speech, delivering 2 powerful sentences in 3 revolutions. This is the highest number possible in 3 revolutions.

Input 2
20
6
3
See. Thats the thing with you Plastics. You think everybody is in love with you when actually everybody hates you.
Output 2
-1

It is impossible for Janis to complete her speech in time.


Comments

There are no comments at the moment.