package main
import (
"fmt"
"strconv"
"strings"
)
func isValid(cmd string) bool {
if len(cmd) < 2 {
return false
}
cmdName := cmd[0]
switch cmdName {
case 'A', 'S', 'W', 'D':
default:
return false
}
step, err := strconv.Atoi(cmd[1:])
if err != nil {
return false
}
if step < 1 || step > 99 {
return false
}
return true
}
type Position struct {
X int
Y int
}
func (p *Position) Run(cmd string) {
cmdName := cmd[0]
cmdStep, _ := strconv.Atoi(cmd[1:])
switch cmdName {
case 'A':
p.X -= cmdStep
case 'D':
p.X += cmdStep
case 'W':
p.Y += cmdStep
case 'S':
p.Y -= cmdStep
}
}
func main() {
var input string
fmt.Scan(&input)
cmds := strings.Split(input, ";")
position := Position{}
for _, cmd := range cmds {
if !isValid(cmd) {
continue
}
position.Run(cmd)
}
fmt.Printf("%v,%v", position.X, position.Y)
}