Go Back
Fifteen Million Merits (100)
Description

In the near future, most of the society must cycle on exercise bikes in order to earn currency called Merits. Bing is an aspiring dancer, who wishes to be featured on the show Hot Shot, a reality contest where winners are able to forgo the bike riding and live luxuriously. The entry fee for it is M Merits.

Each session of cycling, (denoted by C) earns Bing 2000 Merits. Every time he rests (denoted by R), he loses 500 Merits. To keep him energized throughout his journey, he has to spend 200 Merits on food (denoted by F).

Bing initially has 0 Merits with him. Merits shall be deducted (as mentioned above) even if there’s no credit spare (negative credits).

You are given a string describing Bing’s routine (denoted by S). Can he make it to Hot Shot?

Input

The first line of input contains an integer T denoting the number of test cases.
Each test case consists of two lines; the first line is a string S and the next line contains an integer M.

Output

For each test case, output a single line with the string yes or no.

Constraints

1 ≤ T ≤ 100
0 ≤ M ≤ 106

Example
Copy Input

Input:
3
CCCFCRR
5000
CCFFFRRRC
10000
RRFFFFFC
30000

Output:
yes
no
no

Explanation

Case 1:
Here, the total amount of merits left with Bing, after the deductions, is 6800, which is greater than the entry fee M.

Case 2:
Here, the total amount of merits left with Bing, after deductions, is 3900, which is lesser than the entry fee M.

Case 3:
Here, the total amount of merits left with Bing, after deductions, is -1000, which is lesser than the entry fee M.

Single Round Match #06
3 hour contest



Announcement
Scoring will be 100-200-250.
Know more about Black Mirror: Bandersnatch here.

Problem Tags
adhoc, strings

Supported by our Coding Partner