package main
import (
"bufio"
"fmt"
"os"
"strings"
)
func main() {
in := bufio.NewReader(os.Stdin)
s, _ := in.ReadString('\n')
s = strings.TrimSpace(s)
x, y := 0, 0
parts := strings.Split(s, ";")
for _, cmd := range parts {
if len(cmd) == 0 {
continue
}
if len(cmd) != 2 && len(cmd) != 3 {
continue
}
if cmd[0] != 'A' && cmd[0] != 'D' && cmd[0] != 'W' && cmd[0] != 'S' {
continue
}
d := 0
numStr := cmd[1:]
ok := true
for i := 0; i < len(numStr); i++ {
if numStr[i] < '0' || numStr[i] > '9' {
ok = false
break
}
d = d*10 + int(numStr[i]-'0')
}
if !ok {
continue
}
switch cmd[0] {
case 'A':
x -= d
case 'D':
x += d
case 'W':
y += d
case 'S':
y -= d
}
}
fmt.Printf("%v,%v\n", x, y)
}