//ZZU 1073
//2010-3-18
#include<stdio.h>
#include<string.h>
//2010-3-18
#include<stdio.h>
#include<string.h>
#define M 70
typedef int BOOL;
typedef int BOOL;
void mult(int *a, int *b, int e, int &len);
BOOL comp(int *c, int *d, int n, int len);
BOOL comp(int *c, int *d, int n, int len);
int main()
{
char str[M];
int num[M],
ans[M],
length,
strLen,
strl;
while(scanf("%s",str)!=EOF)
{
BOOL flag;
flag=1;
strl=strLen=strlen(str);
for(int i=0; i<M; i++)
num[i]=ans[i]=0;
for(int i=0; i<strLen; i++)
num[strLen-1-i]=str[i]-'0';
for(int count=2; count<=strLen; count++)
{
mult(num, ans, count,strLen);
/*for(int i=0;i<strLen;i++)
printf("%d->",ans[i]);
printf("/n");*/
if(comp(num,ans,strLen,strl)==0)
{
flag=0;
break;
}
for(int i=0; i<M; i++)
ans[i]=0;
}
if(flag)
printf("%s is cyclic/n",str);
else
printf("%s is not cyclic/n",str);
}
return 0;
}
{
char str[M];
int num[M],
ans[M],
length,
strLen,
strl;
while(scanf("%s",str)!=EOF)
{
BOOL flag;
flag=1;
strl=strLen=strlen(str);
for(int i=0; i<M; i++)
num[i]=ans[i]=0;
for(int i=0; i<strLen; i++)
num[strLen-1-i]=str[i]-'0';
for(int count=2; count<=strLen; count++)
{
mult(num, ans, count,strLen);
/*for(int i=0;i<strLen;i++)
printf("%d->",ans[i]);
printf("/n");*/
if(comp(num,ans,strLen,strl)==0)
{
flag=0;
break;
}
for(int i=0; i<M; i++)
ans[i]=0;
}
if(flag)
printf("%s is cyclic/n",str);
else
printf("%s is not cyclic/n",str);
}
return 0;
}
void mult(int *a, int *b, int e, int &len)
{
for(int i=0; i<len; i++)
{
b[i]=b[i]+a[i]*e;
b[i+1]=b[i+1]+b[i]/10;
b[i]=b[i]%10;
}
if(b[len])
++len;
}
{
for(int i=0; i<len; i++)
{
b[i]=b[i]+a[i]*e;
b[i+1]=b[i+1]+b[i]/10;
b[i]=b[i]%10;
}
if(b[len])
++len;
}
BOOL comp(int *a, int *b, int n, int len)
{
if(n>len)
return 0;
int i, j, k;
i=0;
for(j=0; j<n ; )
if(a[i]!=b[j])
j++;
else
{
++i;
for( k=1; k<n; k++)
if(a[i]!=b[(j+k)%n])
{
i=0;
j++;
break;
}
else
++i;
if(k==n)
return 1;
}
return 0;
}
{
if(n>len)
return 0;
int i, j, k;
i=0;
for(j=0; j<n ; )
if(a[i]!=b[j])
j++;
else
{
++i;
for( k=1; k<n; k++)
if(a[i]!=b[(j+k)%n])
{
i=0;
j++;
break;
}
else
++i;
if(k==n)
return 1;
}
return 0;
}