#include <iostream>
#include <unordered_set>
using namespace std;
unordered_set<char> direct = {'A', 'D', 'S', 'W'};
int judge_move(string str) {
int len = str.size();
if (len == 2 && direct.count(str[0]) && (str[1] >= '0' && str[1] <= '9')) {
int num = str[1] - '0';
return num;
} else if (len == 3 && direct.count(str[0]) && (str[1] >= '0' &&
str[1] <= '9') && (str[2] >= '0' && str[2] <= '9')) {
int num = (str[1] - '0') * 10 + (str[2] - '0');
return num;
}
return 0;
}
int main() {
string str;
int x = 0, y = 0;
while (getline(cin, str, ';')) {
int num = judge_move(str);
if (!num) {
continue;
}
switch (str[0]) {
case 'A':
x -= num;
break;
case 'D':
x += num;
break;
case 'S':
y -= num;
break;
case 'W':
y += num;
break;
default:
break;
}
}
cout << x << "," << y << endl;
return 0;
}
// 64 位输出请用 printf("%lld")