#include<iostream> #include<cstring> #include<vector> using namespace std; int main (){ string str; while(cin >> str){ vector<string> temp; char * cstr = new char[str.size()+1]; strcpy(cstr, str.c_str()); char *p = strtok(cstr, ";"); while(p!=0){ temp.push_back(p); p = strtok(NULL, ";"); } int x=0,y=0; for(auto i: temp){ if(i.size()<=3&&i.size()>0){ bool flag = true; int sum = 0; for(int k=1;k<i.size();k++){ if(!isdigit(i[k])){ flag = false; break; }else{ sum = sum*10+(i[k]-48); } } if(!flag) continue; switch(i[0]){ case 'A': x-=sum; break; case 'D': x+=sum; break; case 'W': y+=sum; break; case 'S': y-=sum; break; } } } cout << x << "," << y << endl; } return 0; }