#JSUTCPC2026B. A Number Theory Problem —— 小清新数论题

A Number Theory Problem —— 小清新数论题

Problem Description

This is a simple and easy number theory problem.

lcm(1,2,3,⋯ ,n)\text{lcm}(1,2,3,\cdots,n) denotes the least common multiple of all numbers from 11 to nn. Calculate the remainder of lcm(1,2,3,⋯ ,n)\text{lcm}(1,2,3,\cdots,n) when divided by the prime number pp.

Input

A single line containing two space-separated integers n,pn, p satisfying 1⩽n<p⩽1×1041\leqslant n < p \leqslant 1\times 10^4.

Output

Output a number representing lcm(1,2,3,⋯ ,n) % p\text{lcm}(1,2,3,\cdots,n)~\%~p.

Samples

5 7
4
1919 9973
2007