Loading...
Tafsir Loves Cricket
Time: 2 s
Memory: 125 MB
Everyone knows that Tafsir is a big fan of cricket. Today, he decided to watch a cricket match. Unfortunately, he has an exam tomorrow. To balance his time, he decides to watch the first \(n\) overs of his favorite team's batting innings. Tafsir will go to study happily if his favorite cricketer, Shakib, scores at least as many runs as Tamim during these \(n\) overs.

Initially, Tamim and Shakib are batting, and Tamim is on strike. The game progresses as follows:
  • An over consists of 6 legal balls.
  • On each ball, the batsman on strike can score \(0, 1, 2, 3, 4, 5, \) or \(6\) runs.
  • If the batsman scores:
    • Even runs: The strike does not change, and the same batsman faces the next ball.
    • Odd runs: The strike changes, and the other batsman faces the next ball.
  • At the end of each over, the strike changes automatically.
  • No batsman gets out during these overs.
You are given the runs scored on each of the \(6n\) balls in sequence. Determine whether Tafsir will go to study with a happy face or a sad face after watching \(n\) overs.
Input
The first line contains a single integer \(n\) — the number of overs Tafsir watched.
The second line contains \( 6n\) integers \(s_1, s_2,s_3,...,s_{{6n}}\) where \(s_i\) represents the runs scored on the -\(i\)th ball.
It is guaranteed that all balls are legal. There are no extras (like wides or no-balls). No batsman gets out during these overs.
Constraint
\(1 \leq n \leq 1000\)
\(0 \leq s_i \leq 6\)
Output
In the first line, print "Happy :)" if Shakib's total score is at least as much as Tamim's total score. Otherwise, print "Sad :(".
In the second line, print two integers: the score of Tamim and Shakib, respectively.
Examples
Input
Output
1
1 2 3 4 5 6
Happy :)
10 11
Input
Output
2
1 4 3 6 2 1 6 4 1 6 0 2
Sad :(
21 15
Notes
In the second test case:
Over 1:
  • Ball 1: Tamim scores 1 (strike shifts to Shakib).
  • Ball 2: Shakib scores 4 (no strike shift).
  • Ball 3: Shakib scores 3 (strike shifts to Tamim).
  • Ball 4: Tamim scores 6 (no strike shift).
  • Ball 5: Tamim scores 2 (no strike shift).
  • Ball 6: Tamim scores 1 (strike shifts to Shakib and returns to Tamim).
Over 2:
  • Ball 1: Tamim scores 6 (no strike shift).
  • Ball 2: Tamim scores 4 (no strike shift).
  • Ball 3: Tamim scores 1 (strike shifts to Shakib).
  • Ball 4: Shakib scores 6  (no strike shift).
  • Ball 5: Shakib scores 0 (no strike shift).
  • Ball 6: Shakib scores 2 (strike shifts to Tamim).
Total: Tamim = 21, Shakib = 15. Tamim's score is higher, so the output is "Sad :(".
Problem Info
Problem ID 378
Time Limit 2000 ms
Memory Limit 128000 KB
Moderators tafsiruzzaman , meheraj_hossain_ , lauhemahfus , refred1 , osama_bq , sagorahmedmunna , amirhozaifa , Rakib , Dr_KeK , fahimcp495
Statistics
Submit
You need to Login or Registration for submit your solution