#define first f #define second s #define ll long long #define mp make_pair #define pb push_back #include<bits/stdc++.h> #define pii pair<ll,ll> #define mem(a,b) memset(a,b,sizeof(a)) using namespace std; const int maxn=2e5+5; ll a[maxn],r[maxn]; ll ex_gcd(ll a1,ll b1,ll &x,ll &y...