logo AlgoBeat OnlineJudge
登录 注册

#209356. [ICPC 2020 Shanghai R] The Journey of Geor Autumn

内存限制:1024 MiB 时间限制:1000 ms 标准输入输出
题目类型:VJudge(洛谷) 评测方式:VJudge
上传者: 匿名

题目描述

Once upon a time, there was a witch named Geor Autumn, who set off on a journey across the world. Along the way, she would meet all kinds of people, from a country full of ICPC competitors to a horse in love with dota---but with each meeting, Geor would become a small part of their story, and her own world would get a little bit bigger.

Geor just arrived at the state of Shu where people love poems. A poem is a permutation of . ( is a permutation of means that each is an integer in and that are distinct.) One poem is if for all integer satisfying and , . Here denotes the minimum value among .

Help Geor calculate how many good poems there are, given and . To avoid huge numbers, output the answer modulo .

输入格式

The first line contains two integers and separated by a single space (, ).

输出格式

Output only one integer in one line---the number of good poems modulo .

样例

样例输入 1

1 1

样例输出 1

1

样例输入 2

2 3

样例输出 2

2

样例输入 3

3 2

样例输出 3

4

样例输入 4

4 2

样例输出 4

10