import java.util.Scanner;

// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        while (in.hasNextInt()) { // 注意 while 处理多个 case
            int a = in.nextInt();
            int b = in.nextInt();
            System.out.println(a + b);
        }

        String str=in.nextLine();
        String[] strArr=str.split(";");
        int arrLen=strArr.length;
        int x=0,y=0;
        for(int i=0;i<arrLen;i++){
            int len=strArr[i].length();
            if(len<=1||len>3){
                continue;
            }
            int num=0;

            if((len==2&&Character.isLetter(strArr[i].charAt(0))&&
            Character.isDigit(strArr[i].charAt(1)))||
            (len==3&&Character.isLetter(strArr[i].charAt(0))&&
            Character.isDigit(strArr[i].charAt(1))&&
            Character.isDigit(strArr[i].charAt(2)))            
            ){
                if(len==2){
                    num=strArr[i].charAt(1)-'0'; 
                }
                if(len==3){
                    num=(strArr[i].charAt(1)-'0')*10+(strArr[i].charAt(2)-'0');               
                }

                if(strArr[i].charAt(0)=='A'){
                    x-=num;
                }else if(strArr[i].charAt(0)=='D'){
                    x+=num;
                }else if(strArr[i].charAt(0)=='W'){
                    y+=num;
                }else if(strArr[i].charAt(0)=='S'){
                    y-=num;
                }
                            
            }
            


        }
        System.out.print(x+","+y);





    }
}