import java.util.Map;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        String res = "[ADWS]\\d{1}\\d?";
        Scanner sc = new Scanner(System.in);
        String[] str = sc.nextLine().split(";");
        int x = 0;
        int y = 0;
        Map<String,Integer> map = new HashMap<>();
        for (int i = 0;i < str.length;i++){
            String s = str[i];
            if (s.matches(res)){
                switch (s.charAt(0)){
                    case 'A':x-=Integer.valueOf(s.substring(1));break;
                    case 'D':x+=Integer.valueOf(s.substring(1));break;
                    case 'W':y+=Integer.valueOf(s.substring(1));break;
                    case 'S':y-=Integer.valueOf(s.substring(1));break;
                }
            }
        }
        System.out.println(x+","+y);
    }
}