#include <stdio.h>
int main(){
int x = 0,y = 0; //左右坐标
char str[10000];
fgets(str,sizeof(str),stdin);
int len = strlen(str) - 1;
int start = -1,end = 0,move = 0;
for(int i = 0; i < len; i++){
end = i - start;
//定位分号,并排除空,end值为3说明数字为1位
if(str[i] == 59){//end = 1 即 ;; 跳出,end = 2 空数 跳出
if((end == 3) && (str[start + 2] > 47) && (str[start + 2] < 58)){
move = str[start + 2] - '0';
switch(str[start + 1]){
case 'A': x-=move; break; //A 向左移动n:x-n
case 'D': x+=move; break; //D 向右移动n:x+n
case 'W': y+=move; break; //W 向上移动n:y+n
case 'S': y-=move; break; //S 向下移动n:y-n
}
// 4 是两位数
}else if((end == 4) && (str[start + 2] > 47) && (str[start + 2] < 58) && (str[start + 3] > 47) && (str[start + 3] < 58)){
move = (str[start + 2] - '0')* 10 + (str[start + 3] - '0');
switch(str[start + 1]){
case 'A': x-=move; break;
case 'D': x+=move; break;
case 'W': y+=move; break;
case 'S': y-=move; break;
}
}
start = i;
}
}
printf("%d,%d",x,y);
return 0;
}