Infinite Fence

medium
https://codeforces.com/problemset/problem/1260/C

Prerequisite ->Extended Euclidean Algorithm 

Input Format

Check the link

Output Format

Check the link

Constraints

Check the link

Example

Input

        
Output

        
Previous
Road To Post Office
Next
Infinite Prefixes

Related Questions