You are working in the HR department of a huge corporation. Each employee may have several direct managers and/or several direct subordinates. Of course, his subordinates may also have their own subordinates, and his direct managers may have their own managers. We say employee is a boss of employee if there exists a sequence of employees , such that is the manager of is the manager of , and so on, and is the manager of (of course, if is a direct manager of employee will be a boss of employee ). If is a boss of , then can not be a boss of . According to the new company policy, the salary of an employee with no subordinates is . If an employee has any subordinates, then his salary is equal to the sum of the salaries of his direct subordinates.
You will be given the relations among employees. Find the sum of the salaries of all the employees.
Contains multiple test cases. The first line of each test case contains the number of employees . In the next lines you are given the relations, where the -th character of the -th element is 'Y' if employee is a direct manager of employee , and 'N' otherwise.
For each test case print in a separate line the sum of the salaries of all the employees.