const rl = require("readline").createInterface({ input: process.stdin });
var iter = rl[Symbol.asyncIterator]();
const readline = async () => (await iter.next()).value;
void async function () {
let operatorList = (await readline()).split(';');
let operators = ['A','D','W','S'];
let startPos = [0,0];
let moveItem = '';
let moveDirection = '';
let moveNum = '';
for(let i in operatorList){
moveItem = operatorList[i];
if(moveItem){
moveDirection = moveItem.slice(0,1);
if(operators.indexOf(moveDirection)>-1){
moveNum = moveItem.slice(1);
if(parseInt(moveNum) && moveNum<100 && moveNum>0){
moveNum = parseInt(moveNum);
if(moveDirection == 'A'){
startPos[0]-=moveNum;
}else if(moveDirection=='D'){
startPos[0]+= moveNum;
}else if(moveDirection=='W'){
startPos[1]+= moveNum;
}else if(moveDirection=='S'){
startPos[1]-= moveNum;
}
}
}
}
}
console.log(startPos[0]+','+startPos[1]);
}()