#P7533. Mirko's Card Game Total Score

    ID: 20728 Type: Default 1000ms 256MiB

Mirko's Card Game Total Score

Mirko's Card Game Total Score

Mirko invented a card game. The game uses only five types of cards: A, K, Q, J, and X. Their values are defined as follows:

\(A=4,\quad K=3,\quad Q=2,\quad J=1,\quad X=0\)

You are given N decks, each containing exactly 13 cards. Your task is to compute the total score of all cards across all decks.

inputFormat

The first line contains an integer N representing the number of decks.

Each of the following N lines contains 13 card symbols separated by spaces. Each symbol is one of the following: A, K, Q, J, or X.

outputFormat

Output a single integer representing the total sum of the values of all the cards in all the decks.

sample

1
A K Q J X A K Q J X A K Q
29