import java.util.*;
import java.util.regex.*;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
// 注意 hasNext 和 hasNextLine 的区别
while (in.hasNextLine()) { // 注意 while 处理多个 case
String a = in.nextLine();
String[] num= a.split(";");
int x = 0;
int y = 0;
Pattern p = Pattern.compile("^([ADWS])(\\d{1,2})$");
for (int i=0;i< num.length;i++){
String tmp = num[i];
Matcher m = p.matcher(tmp);
if (m.find()){
String start = m.group(1);
int disp = Integer.parseInt(m.group(2)) ;
switch (start){
case "A": x-=disp;break;
case "D": x+=disp;break;
case "W": y+=disp;break;
case "S": y-=disp;break;
}//switch
}//if
}//for
System.out.println(Integer.toString(x)+','+Integer.toString(y));
}//while
}//zhu
}//main