#include<stdio.h>
#include<conio.h>
char P[]=" %14.0f %14.0f %1.15f\n";
char M[41]="0141592653589793238462643383279502884197";
char N[41],T[41],R[41];
double A[100]={3},B[100];
int C[]={1,10,100};
int a,b,c,d,x,y,z=1;
int main(){
clrscr();
for(x=0;x<40;x++)
if(M[x]-=48) N[x-1]=!a++;
Inicio:
for(x=41;--x;R[x]=10);
do{
R[b=d=y+1]--;
for(a=0,x=40;x--;)
a=M[x]*R[b]+a/10,
T[x]=a?a%10:0;
for(c=0,x=40;x--;)
a=(d?N[--d]:0)-T[x]-c,
T[x]=a+10*(c=a<0);
if(!c) for(y++,x=40;b--;)
N[b]=T[--x];
}while(y<40);
a=b=x=y=0;
do{
N[x]=M[x];
b+=M[x]=T[x];
if(a+=R[++x]||x>36)
A[z]+=R[x]*C[40-x],
printf("%c",A[z]?R[x]+48:32);
}while(x<40);
if(++z<23){
for(B[x=z]=1;x--;)
B[x]=A[x]*B[x+1]+B[x+2];
printf(P,B[0],B[1],B[0]/B[1]);
}
if(b) goto Inicio;
getch();
return 0;
}