#P2613. Modular Inverse of a Rational Number

    ID: 15882 Type: Default 1000ms 256MiB

Modular Inverse of a Rational Number

Modular Inverse of a Rational Number

Given a rational number \( c=\frac{a}{b} \), compute \( c \bmod 19260817 \) where the value is defined as the unique solution \( x \) to the congruence:

\[ b\,x\equiv a \pmod{19260817} \]

It is guaranteed that \( b \) has an inverse modulo \( 19260817 \).

inputFormat

The input consists of two space-separated integers \( a \) and \( b \) representing the rational number \( c=\frac{a}{b}\). You can assume that \( b \) and \( 19260817 \) are coprime.

outputFormat

Output the value of \( c \bmod 19260817 \), which is the unique integer \( x \) satisfying

\[ b\,x\equiv a \pmod{19260817}, \quad 0 \le x < 19260817 \]

sample

1 1
1