#include using namespace std; #define rep(i,a,b) for(int i=(a);i<(b);i++) #define all(a) begin(a),end(a) #define sz(a) (int)(a).size() typedef long long ll; typedef vector vi; typedef pair pii; ll pow_mod(ll a,ll n,ll m){ ll res=1; a%=m; while(n){ if(n%2)res=res*a%m; a=a*a%m;n/=2; } res%=m; if(res<0)res+=m; return res; } int main(){ cin.tie(0)->sync_with_stdio(0); cin.exceptions(cin.failbit); int N;cin>>N; int phi=N; { int n=N,d=2; while(d*d<=n){ if(n%d==0)phi-=phi/d; while(n%d==0)n/=d; d++; } if(n>1)phi-=phi/n; } vectorD; rep(i,1,10010)if(phi%i==0)D.emplace_back(i),D.emplace_back(phi/i); sort(all(D)); D.erase(unique(all(D)),D.end()); for(auto d:D){ if(pow_mod(10,d,N)==1%N){ cout<