#P2613. 【模板】有理数取余

    ID: 1626 远端评测题 1000ms 125MiB 尝试: 0 已通过: 0 难度: 6 上传者: 标签>数学高精度扩展欧几里德,扩欧

【模板】有理数取余

Description

Given a rational number c=abc=\frac{a}{b}, compute cmod19260817c \bmod 19260817.

This value is defined as the solution to bxa(mod19260817)bx\equiv a\pmod{19260817}.

Input Format

There are two lines in total.

The first line contains an integer aa.
The second line contains an integer bb.

Output Format

Output a single integer, representing the result after taking modulo. If there is no solution, output Angry!.

233
666

18595654

Hint

For all testdata, it is guaranteed that 0a10100010\leq a \leq 10^{10001}, 1b10100011 \leq b \leq 10^{10001}, and a,ba, b are not both multiples of 1926081719260817.

Translated by ChatGPT 5