import java.util.HashMap;
import java.util.Map;
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.hasNextLine()) { // 注意 while 处理多个 case
//A 左 x- D 右 x+ W 上 y+ S 下 y-
long x = 0;
long y = 0;
String commandStr = in.nextLine();
if(commandStr.length() >= 1 && commandStr.length() <= 10*10*10*10){
Map<String,Long> indexMap = new HashMap<>();
indexMap.put("A",-1l);
indexMap.put("D",1l);
indexMap.put("W",1l);
indexMap.put("S",-1l);
String[] commandArr = commandStr.split(";",-1);
for(int i=0; i<commandArr.length; i++){
if(commandArr[i].length() == 0) continue;
String starts = commandArr[i].substring(0,1);
boolean isStarts = indexMap.containsKey(starts);
if(isStarts){
String ends = commandArr[i].substring(1);
boolean isEnds = ends.matches("\\d{1,}");
if(isEnds){
long distance = Long.parseLong(ends);
if(distance >= 1 && distance <= 99 ){
if(starts.equals("A") || starts.equals("D")){
x = x + distance * indexMap.get(starts);
}
if(starts.equals("W") || starts.equals("S")){
y = y + distance * indexMap.get(starts);
}
}
}
}
}
System.out.println(x+","+y);
}
}
}
}