#P7533. [COCI 2016/2017 #4] Bridž

[COCI 2016/2017 #4] Bridž

Description

Mirko invented a card game. The cards only include A, K, Q, J\text{A, K, Q, J} and X\text{X}. Their scores are 4,3,2,1,04, 3, 2, 1, 0, respectively.

Given NN decks, each containing 1313 cards, find the total score of all cards in these NN decks.

Input Format

The first line contains an integer NN.

The next NN lines each contain a string KiK_i of length 1313. The string only contains the characters A, K, Q, J, X\text{A, K, Q, J, X}.

Output Format

Output the total score of all cards.

1
AKXAKJXXXAXAQ
25
4
XXXAXXXXXXJXX
KXAXXXQJAXXXX
AQKQXXXKXXKQX
JXXXXXJXXXXXX
40

Hint

[Sample 1 Explanation]

Card Type Number of Cards Score per Card Total Score
A\text{A} 44 4×4=164 \times 4=16
K\text{K} 22 33 2×3=62 \times 3=6
Q\text{Q} 11 22 1×2=21 \times 2=2
J\text{J} 11 1×1=11 \times 1=1
X\text{X} 55 00 5×0=05 \times 0=0

Therefore, the total score is 16+6+2+1+0=2516+6+2+1+0=25.

[Constraints]

For 100%100\% of the testdata, 1N1041 \le N \le 10^4.

[Notes]

This problem is translated from COCI 2016-2017 CONTEST #4 T1 Bridž.

The scoring of this problem follows the original COCI problem settings, with a full score of 5050.

Translated by ChatGPT 5