#include <iostream>
#include <vector>
#include <cctype>
using namespace std;
void SplitString(const std::string& s, std::vector<std::string>& v,
const std::string& c) {
std::string::size_type pos1, pos2;
pos2 = s.find(c);
pos1 = 0;
while (std::string::npos != pos2) {
v.push_back(s.substr(pos1, pos2 - pos1));
pos1 = pos2 + c.size();
pos2 = s.find(c, pos1);
}
if (pos1 != s.length())
v.push_back(s.substr(pos1));
}
int main() {
string strRaw;
cin >> strRaw;
vector<string> strs;
SplitString(strRaw, strs, ";");
pair<int, int> point = {0, 0};
for (auto str : strs) {
if (!isalpha(str[0]) || !isdigit(str[1]) || (str.size() > 2 && !isdigit(str[2]))) {
continue;
}
int len = stoi(str.substr(1, 2));
if (str[0] == 'A') point.first -= len;
if (str[0] == 'D') point.first += len;
if (str[0] == 'W') point.second += len;
if (str[0] == 'S') point.second -= len;
}
cout << to_string(point.first) + "," + to_string(point.second) << endl;
return 0;
}