Cow Solitaire
Late summer on the farm is a slow time, very slow. Betsy has little to do but play cow solitaire. For self-evident reasons, cow solitaire is not so challenging as any number of solitaire games played by humans.
Cow solitaire is played using an grid of ordinary playing cards with four suits (Clubs, Diamonds, Hearts, and Spaces) of cards (Ace, , Jack, Queen, King). Cards are named with two characters: their value followed by their suit . Below is a typical grid when :
8S AD 3C AC 8C 4H QD QS 5D 9H KC 7H TC QC AS 2D
To play this solitaire game, Betsy starts in the lower left corner and proceeds using exactly moves of 'right' or 'up' to the upper right corner. Along the way, she accumulates points for each card (Ace is worth point, is worth points, ..., is worth points, is worth points, is , is and is ) she traverses. Her goal is to amass the highest score.
If Betsy's path was , her score would be . Had she taken the left side then top , her score would be , not as good as the other route. The best score for this grid is points .
Betsy wants to know the best score she can achieve. One of the geek cows once told her something about "working from the end back to the beginning," but she didn't understand what they meant.
Input
First line contains a single integer . The -th next line lists the cards on row (row is the top row) using card names arranged in the obvious order.
Output
Print the best possible score Betsy can achieve.