Counting Phenomenal Arrays
면접 대비시간 제한2초메모리 제한1024 MB
원소들의 곱과 합이 같은 배열을 길이 2부터 n까지 각각 세어 소수로 나눈 나머지를 구한다.
문제
Let's call an array of positive integers \textbf {phenomenal}, if the product of its elements is equal to the sum of its elements (i.e. if ) .
For example, the array is phenomenal, because , and is phenomenal, because , but the array is not phenomenal, as .
Let denote the number of phenomenal arrays of size . It can be shown that for any fixed there is only a finite number of phenomenal arrays of size .
You are given an integer . Find . As these numbers can be very big, output them modulo , where is a given prime number.
입력
The only line of the input contains two integers (, , is prime).
출력
Output integers --- the values modulo .