Under construction

Still being built. Things may change

Problems No Larger Than the Weeds

Interview

Time limit1sMemory limit1024 MB

Summary
Count how many problems have a total character size no greater than the weed size J, where uppercase letters are 4, lowercase letters and digits are 2, and spaces are 1.
Level

Easy2 of 10

Topics
Implementation, String
Solved
No attempts yet

Problem

Weeds grow a lot in summer.

People in Bsil Village are struggling with weeds that shot up suddenly after this summer's monsoon rains. Tasty PS problems are growing in the village fields, but the weeds hide them so they cannot be seen.

The size of a PS problem, made of English letters, spaces, and digits, is the sum of the sizes of its characters. An uppercase letter has size 44, a digit or lowercase letter has size 22, and a space has size 11.

Bihaengssi's field, where the problems for the Bsil Cup were to be harvested, has also been overrun by weeds. With the deadline close, Bihaengssi decided to harvest the problems that have grown bigger than the weeds before pulling the weeds. Problems that are not harvested will grow further for the next contest.

Write a program that gives Bihaengssi the number of problems that are no larger than the weeds, since there is no time to spare.

Input

The first line contains the weed size JJ and the number of growing problems NN, separated by a space. (1≤J,N≤500)(1\le J, N \le 500)

From the second line, NN lines follow, each containing one problem made of English letters, digits, and spaces. Each problem has length from 11 to 100100, and does not start or end with a space.

Output

Print the number of problems that are no larger than the weeds.

Examples1

  1. Example 1

    Input
    8 4
    Quatro cheese pizza
    Alloy coin
    PiPi
    1 2 3
    
    Expected output
    1