import java.util.*;

/**
 * @author Shan
 * @create 2021-05-31 下午 8:02
 */
public class Main {
    public static void main(String args[]) {
        Scanner scn=new Scanner(System.in);
        String[] strs=scn.nextLine().split(";");
        int[] pos=new int[2];
        int[] move=new int[2];
        for(int i=0;i<strs.length;i++){
            if(strs[i].length()==0 || strs[i].charAt(0)=='x' || strs[i].charAt(0)==' ')
                continue;    //跳过无效字符
            if(strs[i].charAt(0)=='A')
                move[0]=-1;
            if(strs[i].charAt(0)=='S')
                move[1]=-1;
            if(strs[i].charAt(0)=='D')
                move[0]=1;
            if(strs[i].charAt(0)=='W')
                move[1]=1;
            int muti=0;
            for(int j=1;j<strs[i].length();j++){
                if(strs[i].charAt(j)=='A' || strs[i].charAt(j)=='S' ||
                   strs[i].charAt(j)=='D' ||strs[i].charAt(j)=='W'){
                    muti=0;        //无效的重复字符
                    break;
                }
                muti=muti*10+strs[i].charAt(j)-'0';
            }
            pos[0]+=move[0]*muti;    //坐标移动
            pos[1]+=move[1]*muti;
            move[0]=0;               //偏移量清零
            move[1]=0;
        }
        System.out.println(pos[0]+","+pos[1]);
    }
}