#include <iostream>
#include <string>
using namespace std;
int x = 0, y = 0;
void left_move(string str) {
if (str.size() == 2) {
if (str[1] >= '0' && str[1] <= '9') {
x -= (str[1] - '0');
}
} else {
if (str[1] >= '0' && str[1] <= '9' && str[2] >= '0' && str[2] <= '9') {
x -= ((str[1] - '0') * 10 + (str[2] - '0'));
}
}
}
void right_move(string str) {
if (str.size() == 2) {
if (str[1] >= '0' && str[1] <= '9') {
x += (str[1] - '0');
}
} else {
if (str[1] >= '0' && str[1] <= '9' && str[2] >= '0' && str[2] <= '9') {
x += ((str[1] - '0') * 10 + (str[2] - '0'));
}
}
}
void up_move(string str) {
if (str.size() == 2) {
if (str[1] >= '0' && str[1] <= '9') {
y += (str[1] - '0');
}
} else {
if (str[1] >= '0' && str[1] <= '9' && str[2] >= '0' && str[2] <= '9') {
y += ((str[1] - '0') * 10 + (str[2] - '0'));
}
}
}
void down_move(string str) {
if (str.size() == 2) {
if (str[1] >= '0' && str[1] <= '9') {
y -= (str[1] - '0');
}
} else {
if (str[1] >= '0' && str[1] <= '9' && str[2] >= '0' && str[2] <= '9') {
y -= ((str[1] - '0') * 10 + (str[2] - '0'));
}
}
}
int main() {
// int a, b;
// while (cin >> a >> b) { // 注意 while 处理多个 case
// cout << a + b << endl;
// }
char ch;
string str;
while (cin >> ch) {
if (ch == ';') {
if (str.size() > 3 || str.size() < 2) {
str.clear();
} else {
switch (str[0]) {
case 'A':
left_move(str);
break;
case 'D':
right_move(str);
break;
case 'W':
up_move(str);
break;
case 'S':
down_move(str);
break;
default:
break;
}
str.clear();
}
} else {
str.push_back(ch);
}
}
cout << x << "," << y << endl;
return 0;
}