Bohan loves milk tea so much and he drinks one cup of milk tea every day. The local shop sells milk tea in two sizes: a Medium cup for $3 and a Large cup for $4. For every cup of milk tea purchased Bohan receives a promotional stamp. Bohan may redeem 6 stamps for a free drink of milk tea regardless of the size. No stamp will be given for a free drink.
Determine the amount of money Bohan have spent on milk tea, given a sequence of milk tea sizes he got in the past a few days. Assume Bohan had no stamps in the beginning and he always redeemed the stamps for the next drink once he had collected 6 stamps.
-----Input-----
The input begins with the number of test cases T.
Each test case has a single line of letters. The i-th letter is either 'M' or 'L' denoting a Medium cup or a Large cup of milk tea Bohan got on the i-th day.
-----Output-----
For each case, output the amount of money in dollars Bohan have spent on milk tea.
-----Constraints-----
- T ≤ 100 
- 1 ≤  length of each sequence ≤ 100 
-----Example-----
Input:
3
MLM
MMLLMMLL
MMMMMMML
Output:
10
24
22
-----Explanation-----
Example 1: Bohan didn't redeem any stamps.
Example 2: Bohan redeemed 6 stamps for the Large cup of milk tea on the 7th day.
Example 3: Bohan redeemed 6 stamps for the Medium cup of milk tea on the 7th day.
t=int(input())
while t>0:
 t-=1
 s=input()
 val=0
 ctr=0
 for i in s:
  if ctr==6:
   ctr=0
  else:
   if i=='M':
    val+=3
    ctr+=1
   else:
    val+=4
    ctr+=1
 print(val)

t=int(input())
while t>0:
 t-=1
 s=input()
 val=0
 ctr=0
 for i in s:
  if ctr==6:
   ctr=0
  else:
   if i=='M':
    val+=3
    ctr+=1
   else:
    val+=4
    ctr+=1
 print(val)
