import java.util.Scanner;
// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int x = 0;
int y = 0;
// 注意 hasNext 和 hasNextLine 的区别
//while (in.hasNextInt()) { // 注意 while 处理多个 case
String str = in.next();
String[] atrAry = str.split(";");
for (int i = 0; i < atrAry.length; i++) {
String temp = atrAry[i];
StringBuilder stringBuilder = new StringBuilder(temp);
String s2 = stringBuilder.reverse().toString();
if (temp.length() < 4 && temp.length() >= 2) {
if (!s2.startsWith("A") && !s2.startsWith("S") && !s2.startsWith("W") &&
!s2.startsWith("D")) {
if (temp.startsWith("A")) {
x = x - Integer.valueOf(temp.substring(1, temp.length()));
} else if (temp.startsWith("W")) {
y = y + Integer.valueOf(temp.substring(1, temp.length()));
} else if (temp.startsWith("S")) {
y = y - Integer.valueOf(temp.substring(1, temp.length()));
} else if (temp.startsWith("D")) {
x = x + Integer.valueOf(temp.substring(1, temp.length()));
}
}
}
}
System.out.println(x + "," + y);
}
}