Junhyung and Minhyung play a sequence game. Before the game starts, Minhyung picks three numbers K, L, and M. Junhyung then has to say K consecutive natural numbers.
Minhyung added one more rule to train Junhyung's mental arithmetic. Among the K numbers Junhyung says, exactly L of them must be happy numbers. A happy number is a number that meets at least one of the two conditions below.
- It is a natural number not greater than M.
- It is a prime (a number with exactly 2 divisors).
Junhyung is slow at mental arithmetic, so he plans to work the answer out on a computer in secret. Write a program that answers Minhyung's questions.