package main
import (
"bufio"
"fmt"
"os"
"strings"
"strconv"
)
func main() {
var x, y int
input := bufio.NewScanner(os.Stdin)
input.Scan()
commands := strings.Split(input.Text(), ";")
for _, v := range commands {
if v == "" || v == " " {
continue
}
if num, err := strconv.Atoi(v[1:]); err != nil {
continue
} else {
command := v[0]
switch command {
case 'A':
x -= num
case 'D':
x += num
case 'W':
y += num
case 'S':
y -= num
}
}
}
fmt.Printf("%d,%d", x, y)
}