#include #include #include #include #include #include #include #include #include #include #define mkp make_pair #define mkt make_tuple #define rep(i,n) for(int i = 0; i < (n); ++i) #define all(v) v.begin(),v.end() using namespace std; typedef long long ll; const ll MOD=1e9+7; template void chmin(T &a,const T &b){if(a>b) a=b;} template void chmax(T &a,const T &b){if(a0){ if(n&1) res=res*a%mod; a=a*a%mod; n>>=1; } return res; } // gcd(a,mod) = 1 ll mod_inv(ll a,ll mod){ ll b=mod,u=1,v=0; while(b){ ll t=a/b; a-=t*b;swap(a,b); u-=t*v;swap(u,v); } u%=mod; if(u<0) u+=mod; return u; } // minimum x for a^x = b (mod) // gcd(a,mod) = 1 // x > 0 [x >= 0] ll mod_log(ll a,ll b,ll mod){ a%=mod;b%=mod; ll sqm=sqrt(mod)+1; map apow; ll val=1; for(int r=0;r0) return res; //return res; } target=target*A%mod; } return -1; } void solve(){ ll N; cin>>N; if(10%N==100%N&&10%N!=1){ cout<<1<<"\n"; return; } ll base=10; if(N%2==0){ while(N%2==0) N/=2; //N/=2; base/=2; } if(N%5==0){ while(N%5==0) N/=5; //N/=5; base/=5; } //cout<>T; rep(i,T) solve(); return 0; }