Limits 1s, 256 MB

Recently Pappu saw a bunch of reviews on the “মহানগর ২” web series. With lots of curiosity, he started watching the first part. After finishing the first part he realized exam finals are approaching and he’s got huge tasks to complete. He is confused because he doesn’t want to stop watching the series as he wants to finish the second part too. As Pappu’s friend, it is your responsibility to help him decide.

Currently, Pappu has nn tasks to finish, numbered from 11 to nn. Each task has a tag number represented by ai.a_i. Pappu has a special attraction towards the last digit of any number. So, he wants to add up all the last digits of all tags. For example, if n=3n = 3 and task tags are 23,6,10023, 6, 100, the last digits will be 3,6,03, 6, 0, correspondingly, their sum is 99.

He also has a favorite number XX. He said that he will only do all his tasks if the SumSum is a multiple of his favorite number XX. In other words, there must exist a non-negative integer YY such that, X×Y=SumX \times Y = Sum. Otherwise, he will just keep watching the series. From the above example the sum is X=9X = 9 and let’s say his favorite number is 33. Since 99 is a multiple of 33, he will do his tasks.

Now, your task is to calculate the SumSum of the last digits of all the task numbers and determine if the SumSum is a multiple of his favorite number of XX.


The first line of the input contains two integers nn and XX separated by space — indicating the number of tasks and Pappu’s favorite number.

The second line of the test case contains n space-separated integers a1,a2,a3,.,ana_1, a_2, a_3,….,a_n — indicating the tag number of each task.

11 n,n, XX 10510^5

11 aia_i 10510^5


If the SumSum of the last digits of the tasks is a multiple of XX, print “Finish all the tasks, including mine!” without quotations. If not then print “You can now watch the series!” without quotations.


3 7
23 4 100
Finish all the tasks, including mine!
5 3
67 33 90 21 9
You can now watch the series!

Be careful about the newline (‘\n’) at the end.


Login to submit.


94% Solution Ratio
Sunny204Earliest, 11M ago
Paul72Fastest, 0.0s
Sunny204Lightest, 4.9 MB
jahid2994Shortest, 281B
Toph uses cookies. By continuing you agree to our Cookie Policy.