ltime66 EVENT WHY MY ANS INS WRONG

LINK FOR THE CODE CodeChef: Practical coding for everyone
PLEASE TELL WHY IS IT GIVING WRONG ANS FOR EVENT QUESTION ASKED IN LUNCHIME

Check out the testcase

monday tuesday 9 9

I think your answer will be impossible but the answer should be 9