#include<stdio.h>
#include<malloc.h>
#include<string.h>

int main() {
    char str[10000];
    int len;
    int x = 0, y = 0, num = 0;
    int i = 0, j = 0;
    scanf("%s", str);
    len = strlen(str);
    for (i = 0; i < len; i++) {
        if (str[i] == 'A' || str[i] == 'D' || str[i] == 'W' || str[i] == 'S') {
            for (j = i + 1, num = 0; j < len; j++) {
                if (str[j] >= '0' && str[j] <= '9') //数字字符
                    num = num * 10 + str[j] - '0'; //转为两位整数
                else
                    break;
            }
            if (str[j] == ';' && num) {
                if (str[i] == 'A')         x -= num;
                else if (str[i] == 'D')    x += num;
                else if (str[i] == 'W')    y += num;
                else if (str[i] == 'S')    y -= num;
            }

            i = j;
        }
        do {
            if (str[i] == ';')
                break;
        } while (++i < len);

    }
    printf("%d,%d", x, y);
}