Modular Inverse
Find with , .
Because is prime, Fermat's little theorem gives .
Input
A single integer (not a multiple of ).
Output
Constraints
Sample 1
Input
2
Output
500000004
Sample 2
Input
3
Output
333333336
Find with , .
Because is prime, Fermat's little theorem gives .
A single integer (not a multiple of ).
Input
2
Output
500000004
Input
3
Output
333333336