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

【模板】有理数取余

Problem 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