#include<iostream>
#include<string>
#include<vector>
using namespace std;
//分割字符串
vector<string> split(string str, const char c){
vector<string> sstr;
int pos = 0;
while (pos < str.length()){
int end;
for (end = pos; str[end] != c && end < str.length(); end++);
sstr.push_back(str.substr(pos, end - pos));
pos = end + 1;
}
return sstr;
}
//判断合法性
bool judge(string str){
int count = 0;
for (int i = 0; i < str.size(); ++i) {
if (str[i] == 'A' || str[i] == 'S' || str[i] == 'D' || str[i] == 'W'){
count++;
}
}
return count == 1;
}
int main(){
string inputs;
cin >> inputs;
int x = 0;
int y = 0;
vector<string> allStr = split(inputs, ';');
for (auto it = allStr.begin(); it != allStr.end(); it++){
if (judge(*it)){
//截取数字,并将string转换成c字符串,然后将c字符串用atoi转换成数字
int num = atoi(((*it).substr(1)).c_str());
switch ((*it)[0])
{
case 'A':
x -= num; break;
case 'S':
y -= num; break;
case 'W':
y += num; break;
case 'D':
x += num; break;
}
}
}
cout << x << "," << y << endl;
return 0;
}