#include <iostream>
#include <cctype>
#include <string>
#include <vector>
using namespace std;

bool hastwo(string s){
    for(auto ch:s.substr(1))
        if(isupper(s[0])&&isupper(ch))
            return true;
    return false;
}

int main() {
    int x = 0, y = 0;
    string movement="", sentence;
    vector<string> movements;
    getline(cin, sentence);
    for(int i = 0;i<sentence.size();i++){
        if(sentence[i]==';'){
            if(movement != ""){
                movements.push_back(movement);
                movement = "";
            }
            continue;
        }
        movement.push_back(sentence[i]);
    }
    for(auto m:movements){
        if(m.size()<2)
            continue;
        else if(!isupper(m[0]))
            continue;
        else if(m.size() >=4)
            continue;
        else if(hastwo(m))
            continue;
        else {
            int tmp = atoi(m.substr(1).c_str());
            switch(m[0]){
                case 'A':x -=tmp;break;
                case 'D':x += tmp;break;
                case 'W':y+=tmp;break;
                case 'S':y-=tmp;break;
                default:
                    continue;
            }
        }
    }
    cout << x<<","<<y<<endl;
}
// 64 位输出请用 printf("%lld")