프로그램 명: coci_majstor
제한시간: 1 초

Rock-paper-scissors is a popular two-player game. In the game, each of the players uses their hand to show one of three symbols: rock, paper or scissors. If both players show the same symbol, the game is a tie. Otherwise, scissors beat paper, paper beats rock and rock beats scissors.

Sven has been studying the psychological intricacies of the game for years and has become a real master at the game, his friends not standing a chance against him in one-on-one games.

With the world championships around the corner, Sven is practicing his skills playing simultaneous games with N of his friends. One such game consists of R rounds. In each round, Sven and each of his friends show one of the three symbols.

When calculating the score, in each round, Sven's symbol is independently compared to each of his friends' symbols. Sven scores two points for every win and one point for every tie. Sven does not get points for losing.

Write a program that calculates Sven's total score, and also his largest possible score had he known in advance all the symbols his friends would show.

입력

출력

Output Sven's actual score on the first line. Output his largest possible score on the second line, assuming his friends didn't change their symbols.

입출력 예

input 

5 
SSPPR 
1 
SSPPR 

output 

5 
10 

input 

5 
SSPPR 
2 
PPRRS 
RRSSP 

output 

10 
15 

input 

4 
SPRS 
4 
RPRP 
SRRR 
SSPR 
PSPS 

output 

12 
21 
출처:coci/2008-2009/regional

[질/답] [제출 현황] [푼 후(0)]
[ 채 점 ] [홈으로]  [뒤 로]