A Cron Spec is used by Linux to specify when to repeatedly execute a certain job. For this problem, consider a Simple Cron Spec that defines when a job needs to be run within a single day. A Simple Cron Spec has three space separated tokens:
that specify at which hours/minutes/seconds a job will be run. Hour values are $0$-$23$, minute and second values are $0$-$59$.
Each token consists of a single integer value, a value range (two values separated by a dash ‘-’), a comma-separated list of multiple values and/or value ranges, or an asterisk (‘*’). A value range represents all integer values between the low and high value, inclusive. An asterisk is a special token that represents all possible values. The specified values in any comma separated list must be non-overlapping.
For example, the specification:
says the job will be run every hour, at minute $30$, and second $20$, $25$, $30$, $31$, $32$, and $33$, for a total of $24 \times 1 \times 6 = 144$ times each day.
Given a list of Simple Cron Specs, determine two things: First, the number of seconds in the day that at least one job will start, and second, the total number of job starts during the day. Note that if a single job starts 24 times in a day, that counts as 24 job starts.
The first line of input contains a single integer $n$ ($1 \le n \le 100$), which is the number of Simple Cron Specs that follow.
Each of the next $n$ lines contains three strings $h$, $m$ and $s$. These are the hours, minutes, and seconds specifications of the Simple Cron Specs. Each $h$, $m$ and $s$ consists of either a single star (‘*’), or a comma-separated list of one or more values or value ranges (two values separated by ‘-’). The values/ranges are guaranteed to be within the appropriate limits ($0$ to $23$ for hours, $0$ to $59$ for minutes and seconds), and are guaranteed to not overlap. All range specifications are guaranteed to consist of two distinct values, smallest first. All values specified in a comma-separated list are guaranteed to be in strictly increasing order. The whole is guaranteed to be a legitimate Simple Cron Spec. The only spaces in the line will be a single space between $h$ and $m$, and a single space between $m$ and $s$.
Output two space separated integers. The first is the number of seconds in the $24$ hour day with at least one job start, and the second is the total number of job starts.
|Sample Input 1||Sample Output 1|
2 * 30 20,25,30-33 9,15 30 *