#include <iostream>
using namespace std;

int main() {
    string str;
    cin >> str;
    int x = 0, y = 0;//初始坐标
    for (int i = 0; i < str.length(); ) {
        //解析字符串
        int j = i;
        for (; j < str.length(); ++j) {
            if (str[j] == ';')
                break;
        }
        if (j - i == 2) {
            //三个符号
            if (str[i + 1] > '0' && str[i + 1] <= '9') {
                int move = str[i + 1] - '0';
                if (str[i] == 'A') {
                    x = x - move;
                } else if (str[i] == 'D') {
                    x = x + move;
                } else if (str[i] == 'W') {
                    y = y + move;
                } else if (str[i] == 'S') {
                    y = y - move;
                }
            }

        } else if (j - i == 3) {
            //四个符号
            if (str[i + 1] > '0' && str[i + 1] <= '9' && str[i + 2] >= '0' &&
                    str[i + 2] <= '9') {
                int move = (str[i + 1] - '0') * 10 + str[i + 2] - '0';
                if (str[i] == 'A') {
                    x = x - move;
                } else if (str[i] == 'D') {
                    x = x + move;
                } else if (str[i] == 'W') {
                    y = y + move;
                } else if (str[i] == 'S') {
                    y = y - move;
                }
            }
        }
        i = j + 1;
    }
    cout<<x<<","<<y;
}
// 64 位输出请用 printf("%lld")