#include <iostream>
#include <vector>
using namespace std;
int main() {
string s;
cin >> s;
// 1. 获取所有;前的指令字符串
string temp_cmd = "";
vector<string> cmds;
cmds.clear();
for(char ch : s){
if (ch != ';') {
temp_cmd += ch;
} else {
cmds.push_back(temp_cmd);
temp_cmd = "";
}
}
int x = 0;
int y = 0;
// 2. 遍历指令字符串数组,对有效的指令字符串进行操作
for (int i = 0; i < cmds.size(); i ++) {
int len = cmds[i].size();
char cmd = ' ';
int move = 0;
// 移动步数两位数
if (len == 3) {
cmd = cmds[i][0];
if ((cmds[i][1] >= '0' && cmds[i][1] <= '9')
&& (cmds[i][2] >= '0' && cmds[i][2] <= '9')) {
move = (cmds[i][1] - '0') * 10 + cmds[i][2] - '0';
}
}
// 移动步数个位数
if (len == 2) {
cmd = cmds[i][0];
if (cmds[i][1] >= '0' && cmds[i][1] <= '9') {
move = cmds[i][1] - '0';
}
}
switch (cmd) {
case 'A':
x -= move;
break;
case 'D':
x += move;
break;
case 'S':
y -= move;
break;
case 'W':
y += move;
break;
default:
break;
}
}
cout << x << "," << y << endl;
}
// 64 位输出请用 printf("%lld")