#include <iostream>
#include <algorithm>
using namespace std;
const int score[17] = {0,-50,-2,-3,-4,-5,-6,-7,-8,-9,-10,-20,-30,-40,-100,100,0};
int solve()
{
int n;
if (!(cin >> n))exit(0);
bool flag[17] = {};
int id , s = 0, cnt = 0;
for (int i = 1; i <= n; i ++)
{
char c;
int x;
cin >> c >> x;
id = 0;
if (c == 'H')
{
id = x;
cnt ++;
s += score[id];
}
if (c == 'S') id = 14;
if (c == 'D') id = 15;
if (c == 'C') id = 16;
flag[id] = true;
}
if (cnt == 13)s = 200;
if (flag[14])s -= 100;
if (flag[15])s += 100;
if (cnt == 13 && flag[14] && flag[15])s = 500;
if (flag[16])
{
if (s == 0)s = 50;
else s *= 2;
}
return s;
}
string to_str(int x)
{
string op , ttt;
if (x < 0)
{
op = "-";
x = -x;
}
else if (x > 0)op = "+";
do
{
ttt += char(x % 10 + '0');
x /= 10;
}while (x);
reverse(ttt.begin() , ttt.end());
return op + ttt;
}
int main ()
{
while (1)
{
string s;
for (int i = 1; i <= 4; i ++)
{
int t = solve();
s += to_str(t) + " ";
}
if (s == "0 0 0 0 ")return 0;
else cout << s << endl;
}
}