//Matt Kim  Commack HS Intermediate

import java.util.*;

public class BridgeMK

{

    public static void main(String[] args)

    {

        for (int x = 0; x < 5; x++)

        {

            Scanner sc = new Scanner(System.in);

            String line = sc.nextLine();

            StringTokenizer st = new StringTokenizer(line);

            int bid = Integer.parseInt(st.nextToken().substring(0, 1));

            String two = st.nextToken();

            int numWon = Integer.parseInt(two.substring(0, two.length() - 1));

            char suit = st.nextToken().charAt(0);

            char vulnerable = st.nextToken().charAt(0);

            int differential = numWon - bid - 6;

            if (differential == 0)

            {

                if (suit == 'H' || suit == 'S')

                    System.out.println(bid * 30 + ", 0");

                else if (suit == 'C' || suit == 'D')

                    System.out.println(bid * 20 + ", 0");

                else if (suit == 'T')

                    System.out.println(40 + (bid - 1) * 30 + ", 0");

            }

            else if (differential > 0)

            {

                if (suit == 'H' || suit == 'S')

                     System.out.println(bid * 30 + ", " + differential * 30);

                else if (suit == 'C' || suit == 'D')

                    System.out.println(bid * 20 + ", " + differential * 20);

                else if (suit == 'T')

                    System.out.println((40 + (bid - 1) * 30) + ", " + differential * 30);

            }

            else if (differential < 0)

            {

                if (vulnerable == 'V')

                    System.out.println("0, " + 100 * -differential);

                else

                    System.out.println("0, " + 50 * -differential);

            }

        }

    }

 

}