#include <iostream>
#include <string>
#include <algorithm>
#include <sstream>
using namespace std;
static int x = 0,y = 0;
void WASD(string& s)
{
if((s.size() == 3 || s.size() == 2) && isupper(s[0]))
{
int offset;
if(s.size() == 3 && isdigit(s[1]) && isdigit(s[2])) offset = atoi(s.substr(1,2).c_str());
else if(s.size() == 2 && isdigit(s[1])) offset = atoi(&s[1]);
else return;;
switch(s[0])
{
case 'W':
y += offset;
break;
case 'A':
x -= offset;
break;
case 'S':
y -= offset;
break;;
case 'D':
x += offset;
break;
default:
break;
}
}
}
int main() {
string s;
while (getline(cin,s)) { // 注意 while 处理多个 case
stringstream ss(s);
string st;
while(getline(ss,st,';'))
{
if(!st.empty())
{
WASD(st);
}
}
cout << x << "," << y << endl;
}
}
// 64 位输出请用 printf("%lld")