QOJ.ac

QOJ

Time Limit: 1 s Memory Limit: 64 MB Total points: 100

#11051. Enumeration of Road Network Plans

الإحصائيات

Byteman is going for a car trip around Byteland, but he is unfortunately unable to buy a map of the country. His friends told him about some properties of the bytean road network:

  • There are $ n $ cities in Byteland, numbered from 1 to $ n $.
  • Each road is bidirectional and connects two different cities.
  • Each pair of different cities is connected by exactly one path, consisting of one or more roads, on which no city appears more than once.
  • The longest path, on which no city appears more than once, consists of $ d $ roads.

Using information that he managed to collect, Byteman is going to try to reconstruct the road map of Byteland. Byteman would not like to work on it too much, so he would like to know the number of different road network plans satisfying the given conditions. During comparison of plans Byteman does not take exact locations of cities into consideration, but only the plan of connections; moreover, he is not interested in particular city numbers. In other words, Byteman considers two plans the same if and only if there exists a one-to-one mapping from cities of one plan to the cities of the other one, such that if cities $ u $ and $ v $ are connected by a road on the first plan then their equivalents $ u'$ and $v'$ are also connected by a road on the second plan.

Write a program that:

  • reads numbers $ n $, $ d $ and $ p $ from the standard input,
  • computes the number of different road network plans, that are consistent with information that Byteman managed to collect, modulo $ p $,
  • writes the result to the standard output.

Input Format

The first and only line of the input contains three integers $ n $, $ d $ and $ p $ ($1 ≤ n ≤ 200$, $0 ≤ d < n $, $ n < p ≤ 10^{9}$, $ p $ is a prime number), separated with single spaces.

Output Format

The first and only line of output should contain a single integer - the remainder of the division by $ p $ of the number of different plans that are consistent with conditions known to Byteman.

Example

Input

6 3 13

Output

2
problem_11051_1.gif
About Issues

We understand that our problem archive is not perfect. If you find any issues with the problem, including the statement, scoring configuration, time/memory limits, test cases, etc.

You may use this form to submit an issue regarding the problem. A problem moderator will review your issue and proceed it properly.

STOP! Before you submit an issue, please READ the following guidelines:

  1. This is not a place to publish a discussion, editorial, or requests to debug your code. Your issue will only be visible by you and problem moderators. Other users will not be able to view or reply your issues.
  2. Do not submit duplicated issues. If you have already submitted one, please wait for an moderator to review it. Submitting multiple issues will not speed up the review process and might cause your account to be banned.
  3. Issues must be filed in English or Chinese only.
  4. Be sure your issue is related to this problem. If you need to submit an issue regarding another problem, contest, category, etc., you should submit it to the corresponding page.

Active Issues 0

No issues in this category.

Closed/Resolved Issues 0

No issues in this category.