#include <iostream>
#include <string>
#include<unordered_map>
using namespace std;
unordered_map<char,pair<int,int>> mp={
{'A',{-1,0}},
{'W',{0,1}},
{'S',{0,-1}},
{'D',{1,0}}
};
//执行移动命令
void doCommand(pair<int,int>& p,string& command){
char comm='\0';
if(mp.count(command[0])){
comm=command[0];
}
if(comm=='\0') return;//首字母必须要是A、W、D、S
int i=1,n=command.size(),num=0;
while(i<n&&command[i]>='0'&&command[i]<='9'){
num=num*10+command[i]-'0';
i++;
}
if(i!=n) return;//末尾必须要是数字
p.first+=mp[comm].first*num;
p.second+=mp[comm].second*num;
}
int main(){
string s;
getline(cin,s);
int i=0,n=s.size();
pair<int,int> point;
while(i<n){
int start=i;
while(i<n&&s[i]!=';') i++;
string command=s.substr(start,i-start);//读取出命令
doCommand(point,command);//执行命令
i++;
}
printf("%d,%d",point.first,point.second);
}