let str;
while ((str = readline())) {
  str = str.split(";");
  let arr = [];
  for (let item of str) {
    if (/^[ADWS][0-9]{1,2}$/.test(item)) {
      arr.push(item);
    }
  }
  let x = 0,
    y = 0;
  for (let item of arr) {
    let dir = item[0];
    let num = parseInt(item.slice(1));
    switch (dir) {
      case "A":
        x -= num;
        break;
      case "D":
        x += num;
        break;
      case "W":
        y += num;
        break;
      case "S":
        y -= num;
        break;
    }
  }
  print(`${x},${y}`)
}