#include using namespace std; //#include //using namespace atcoder; using ll=long long; using Graph=vector>; #define MAX 200003 #define MOD 1000000007 #define INF 1000000000000000000 int main(){ ll N; cin>>N; for(ll i=2;i*i<=N;i++){ ll d=N%i; ll n=N; bool flag=true; while(n>0){ if(n%i!=d){ flag=false; break; } n/=i; } if(flag==true){ cout<0;i--){ if((N-i)%i!=0){ continue; } ll ans=(N-i)/i; if(ans