Bridge Honor Points

Given N strings of 13 card characters, add up honor points (A=4, K=3, Q=2, J=1) across all hands and print the total.

Easy2ImplementationStringBrute forceInterviewNo attempts yetTime limit1sMemory limit32 MB

Problem

After a few months with his new phone, Mirko decided to find a new hobby. That is how he ran into a card game called bridge.

Bridge is played by four players with a deck of 52 cards. There are four suits (clubs, hearts, diamonds, spades) and thirteen values (A, K, Q, J, 10, 9, 8, 7, 6, 5, 4, 3, 2). Every player gets 13 cards at the start of a game.

Before the game starts, each player counts the honor points in their hand like this:

  • each ace (A) is worth 4 points
  • each king (K) is worth 3 points
  • each queen (Q) is worth 2 points
  • each jack (J) is worth 1 point
  • every other card is worth 0 points, and this task writes it as X

Mirko took up bridge only recently, so he decided to practice counting. He dealt himself a hand NN times, counted his honor points each time, and added everything up at the end.

He wants to know whether he got it right. Check it for him.

Input

The first line contains the integer NN (1N100001 \le N \le 10000).

Each of the next NN lines contains one string KiK_i. Each KiK_i has length 13 and consists only of the characters 'A', 'K', 'Q', 'J', 'X', and it describes the cards Mirko held after the ii-th deal.

Output

Print the total sum of the honor points on a single line.

Hint

In the first example Mirko holds 4 aces, 2 kings, 1 queen and 1 jack, so his honor points come to 4×4+2×3+1×2+1×1=254 \times 4 + 2 \times 3 + 1 \times 2 + 1 \times 1 = 25.