in_s = str(input())
in_list = in_s.split(';')
pos = [0,0]
control = {
    'W':[1,1], # [x/y轴,正向/负向]
    'A':[0,-1],
    'S':[1,-1],
    'D':[0,1]
}
for info in in_list:
    # 确认数据
    if len(info) == 0:
        continue
    direction = info[0]
    if direction not in control:
        continue
    long = info[1:]
    if 1<=len(long)<=2:
        if not long.isdigit():
            continue
        else:
            long = int(long)
    else:
        continue
    # 改变方向
    pos[control[direction][0]] += control[direction][1]*long
print('{},{}'.format(pos[0],pos[1]))