Z  — Time Deposit

Time Limit: 1 sec
Memory Limit: 32 MB

In order to reduce the effect of inflation you have recently put all your savings into a bank for the time deposit. According to rules of this deposit, interest is calculated only on working days. And now you are interested in knowing the real value of your deposit (with interest). But in order to calculate the value of the deposit you have to know the number of working days. So you decided to write a program which is able to calculate the number of working days in any given period of time.

Normally a working day is any day except Saturday and Sunday, however there are exceptions. For each exceptional date you will be given if it is a working or not.

INPUT

There is a number of tests T (T ≤ 100) on the first line. Each test starts with the integer N (N ≤ 100), the number of exception dates. On next N lines there are dates in format yyyy-mm-dd followed by a character W or H. W stands for the exceptional working day and H — for holiday. Next two lines contain period start and end dates respectively. All dates will be between 1975-01-01 and 2025-12-31 and there won’t be more than one exceptional date on each date in single test.

OUTPUT

For each test case output a single line "Case T: N". Where T is the test case number (starting from 1) and N is the number of working days between start and end dates inclusive.

SAMPLE INPUT

2
3
2008-01-01 H
2008-01-02 H
2008-01-11 W
2008-01-01
2008-02-01
0
2008-01-01
2009-01-01

SAMPLE OUTPUT

Case 1: 22
Case 2: 263

HINT

For this task you may assume that all leap years are divisible by 4.


Problem by: Aleksej Viktorchik; Leonid Sislo
Huge Easy Contest #2