/*
 * 解题思路: 按';'符号分割字符串,判断字符串合法性
 * 解题步骤:
 *         1. 按 ';' 符号分割字符串
 *         2. 过滤长度非法、移动步数非法的子串
 *         3. 按移动方向计算x、y轴,非法的移动方向将被忽略
 */
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNextLine()) {
            int x = 0;
            int y = 0;
            String[] strs = sc.nextLine().split(";");
            for (int i = 0; i < strs.length; i++) {
                int len = strs[i].length();
                if (len > 3 || len < 2) {
                    continue;
                }

                if (strs[i].charAt(1) < '0' || strs[i].charAt(1) > '9') {
                    continue;
                }
                if (len == 3 && (strs[i].charAt(2) < '0' || strs[i].charAt(2) > '9')) {
                    continue;
                }

                int step = Integer.parseInt(strs[i].substring(1, len));
                switch (strs[i].charAt(0)) {
                    case 'A' :
                        x -= step;
                        break;
                    case 'D' :
                        x += step;
                        break;
                    case 'S' :
                        y -= step;
                        break;
                    case 'W' :
                        y += step;
                        break;
                    default :
                        break;
                }
            }
            System.out.println(x + "," + y);
        }
    }
}