#include <iostream>
#include <string>
#include <vector>
using namespace std;
//isdigit
int main (){
    vector<string> str(10000);
    int i = 0, n = 0, x = 0, y = 0;
    char ch;
    while(getline(cin, str[i++], ';')){}
    for(i = 0; i < str.size(); ++i){
        if(str[i].size() > 3 && str[i].empty())
            continue;
        if(isdigit(str[i][1]) && str[i].size()==2)
           n = (int)(str[i][1] - '0');
        if(isdigit(str[i][2]) && str[i].size()==3)
           n = (int)(str[i][1] - '0') * 10 + (int)(str[i][2] - '0');
        if(n == 0) continue;
        if(str[i][0] == 'A')
            x -= n;
        else if(str[i][0] == 'D')
            x += n;
        else if(str[i][0] == 'W')
            y += n;
        else if(str[i][0] == 'S')
            y -= n;
        n = 0;
    }
    cout << x << ',' << y;
}