#include<string>
#include<iostream>
#include<algorithm>
#include<vector>
#include<set>
#include<functional>
using namespace std;
bool Valid(string A)
{
if(A[0] == 'A' || A[0] == 'D' || A[0] == 'W' || A[0] == 'S')
{
if( A.length() <= 3 && A.length() >= 2 )
{
if(A.length() == 2)
{
if( A[1] <= '9' && A[1] >= '0' ) return true;
else return false;
}
else
{
if( A[1] <= '9' && A[1] >= '0' && A[2] <= '9' && A[2] >= '0' ) return true;
else return false;
}
}
else return false;
}
else return false;
}
string MovePos(string A)
{
int len = A.length(), x_axis = 0, y_axis = 0;
for(int i = 0; i < len;i++)
{
string tmp;
while( A[i] != ';' )
{
tmp += A[i];
i++;
}
if( Valid(tmp) )
{
if(tmp[0] == 'A' || tmp[0] == 'D')
{
if(tmp.length() == 3)
{
int offset = (tmp[1]-'0')*10 + (tmp[2]-'0');
tmp[0] == 'A' ? x_axis -= offset : x_axis += offset;
}
else
{
int offset = (tmp[1]-'0');
tmp[0] == 'A' ? x_axis -= offset : x_axis += offset;
}
}
else
{
if(tmp.length() == 3)
{
int offset = (tmp[1]-'0')*10 + (tmp[2]-'0');
tmp[0] == 'S' ? y_axis -= offset : y_axis += offset;
}
else
{
int offset = (tmp[1]-'0');
tmp[0] == 'S' ? y_axis -= offset : y_axis += offset;
}
}
}
}
string res;
res += to_string(x_axis);
res += ',';
res += to_string(y_axis);
return res;
}
int main()
{
string n;
while(cin>>n)
{
cout<<MovePos(n)<<endl;
}
return 0;
}