#include <iostream>
using namespace std;

int main() {
    std::string move;
    int i, x = 0, y = 0, dist;
    char dir;
    while (std::getline(cin, move, ';')) {
        if (move.empty()) continue;
        dir = move[0];
        string rest = move.substr(1);
        if (rest.size() == 1 && rest[0]>='0' && rest[0] <='9'){
            dist = rest[0]-'0';
        } else if (rest.size() == 2 && rest[0]>='0' && rest[0] <='9' && rest[1]>='0' && rest[1]<='9'){
            dist = (rest[0]-'0')*10 + rest[1]-'0';
        }
        else continue;
        switch (dir) {
            case 'A':
                x -= dist;
                break;
            case 'D':
                x += dist;
                break;
            case 'W':
                y += dist;
                break;
            case 'S':
                y -= dist;
                break;
            default:
                continue;
        }
    }
    cout << x << "," << y << endl;
}