import java.util.Scanner;

// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String str = in.nextLine();
        char[] c = str.toCharArray();
        int[] po = slove(c);
        System.out.println(po[0] + ","+ po[1]);
    }
    public static int[] slove(char[] c) {
        int[] position_final = new int[2];
        int[] position_start = {0,0};
        char[] c1 = new char[3];
        int count = 0;//字符计数器
        int index = 0;
        for(int i = 0; i < c.length; i++) {
            
            if(c[i] != ';') {
                count++;
            }else {
                if(count == 3) {
                    index = i;
                    for(int j = 0; j < 3; j++) {
                        c1[j] = c[index - 3];
                        index++;
                    }
                    index = 0;
                    count = 0;
                    if((c1[0] == 'A' || c1[0] == 'W' || c1[0] == 'D' || c1[0] == 'S') && Character.isDigit(c1[1]) && Character.isDigit(c1[2])) {
                        int num = (c1[1] -'0') * 10 + c1[2] -'0';
                        position_final = cal(c1[0], num, position_start);
                    }
                }else if(count == 2) {
                    index = i;
                    for(int j = 0; j < 2; j++) {
                        c1[j] = c[index - 2];
                        index++;
                    }
                    index = 0;
                    count = 0;
                    if((c1[0] == 'A' || c1[0] == 'W' || c1[0] == 'D' || c1[0] == 'S') && Character.isDigit(c1[1])) {
                        int num = c1[1] -'0';
                        position_final = cal(c1[0], num, position_start);
                    }
                }
                count = 0;
            }
        }
        return position_final;
    }
    public static int[] cal(char c, int num, int[] position) {
        switch(c) {
            case 'A':
            position[0] -= num;
            return position;
            case 'W':
            position[1] += num;
            return position;
            case 'D':
            position[0] += num;
            return position;
            case 'S':
            position[1] -= num;
            return position;
            default:
            return position;
        }

    }
}