import java.util.*;
public class Main {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
while(sc.hasNext()){
String input = sc.nextLine();
String[] str=input.split(";");
int x = 0,y = 0;
for(int i = 0;i < str.length;i++){
if(correctCoordinate(str[i])){
if(str[i].charAt(0)‘A’){
x = x-Integer.parseInt(str[i].substring(1));
}
else if(str[i].charAt(0)‘D’){
x = x+Integer.parseInt(str[i].substring(1));
}
else if(str[i].charAt(0)‘W’){
y = y+Integer.parseInt(str[i].substring(1));
}
else if(str[i].charAt(0)‘S’){
y = y-Integer.parseInt(str[i].substring(1));
}
}
}
System.out.println(x+","+y);
}
}
public static boolean correctCoordinate(String s){//判斷是否合法有效
int n = s.length();
if(n <= 3 && n>1){
if(s.charAt(0)=='A'||s.charAt(0)=='D'||s.charAt(0)=='W'||s.charAt(0)=='S'){
if(n == 2 && Character.isDigit(s.charAt(1))){
return true;
}
else if(n == 3 && Character.isDigit(s.charAt(1))
&& Character.isDigit(s.charAt(2))){
return true;
}
}
}
return false;
}
}
class Main1{
//最大子串的和
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int[] nums = new int[n];
for(int i = 0;i < n;i++){
nums[i] = sc.nextInt();
}
int max = nums[0];
int curMax = nums[0];
for(int i = 1;i < n;i++){
curMax = Math.max(curMax+nums[i],nums[i]);
if(curMax > max){
max = curMax;
}
}
System.out.println(max);
}
}import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int year = sc.nextInt();
int month = sc.nextInt();
int day = sc.nextInt();
int dayNum = 0;
if (year <= 0 || month <= 0 || month > 12 || day <= 0 || day > 31) {
System.out.println(-1);
} else {
for (int i = 1; i < month; i++) {
if (i == 1 || i == 3 || i == 5 || i == 7 || i == 8 || i == 10 || i == 12) {
dayNum += 31;
} else if (i == 4 || i == 6 || i == 9 || i == 11) {
dayNum += 30;
} else if (i == 2 && (year % 400 == 0 || (year % 4 == 0 && year % 100 != 0))) {
dayNum += 29;
} else {
dayNum += 28;
}
}
System.out.println(dayNum+day);
}
}
}