#Alex Vasilyev
#Enloe High School
#Senior 3
#Dec. 11, 2008
def calcTrick(trump, first):
if trump ==
"T":
if first:
return 40
return 30
if trump ==
"H" or trump == "S":
return 30
if trump ==
"C" or trump == "D":
return 20
class Team(object):
def
__init__(self):
self.below =
0
self.over = 0
self.vuln =
False
def reset(self):
self.below =
0
self.vuln =
False
def __str__(self):
return
str(self.below) + ", " + str(self.over)
def main():
teams = [Team(),
Team()]
for loop in
range(5):
putin =
raw_input().split(", ")
team =
teams[int(putin[0]) - 1]
other =
teams[int(putin[0]) % 2]
bid =
int(putin[1])
line = bid +
6
tricks =
int(putin[2])
trump =
putin[3]
if team.below
>= 100 or other.below >= 100:
team.reset()
other.reset()
if tricks
< line:
if
team.vuln:
other.over += 100 * (line - tricks)
else:
other.over += 50 * (line - tricks)
other.vuln = True
else:
first =
True
for trick in range(bid):
team.below += calcTrick(trump, first)
if
first:
first = False
for trick
in range(tricks - line):
team.over += calcTrick(trump, first)
if
first:
first = False
team.vuln
= True
print
str(teams[0]) + ", " + str(teams[1]) + "\n"
main()
raw_input()