#include<cstdio>
using namespace std;
int n,x,s,t,m,f;
int main()
{
scanf("%d",&x);
s=t=1;
while (1)
{
if (t%x==0)
{
m=t/x;
printf("%d %d\n",m,s);
break;
}
else
{
m=t/x;
if (m>0||(m==0&&f))
{
printf("%d",m);
}
s++;
t=t%x;
}
t=t*10+1;
if (t>x)
f=1;
}
}