#include <stdio.h>
#include <stdlib.h>
int pgcd( int a, int b, int* cpt)
{ int r;
  int q;
  *cpt = 0;
  while ( b > 0 ) {
    r = a % b; 
    q = a / b;
    a = b; 
    b = r;
    *cpt = *cpt + q;
  }
  return a;
}

int main( int argc, char *argv[])
{ int a, b, sup;
  int tmp, max, moy;
 
 sup = atoi( argv[1] );
 for( a = 1; a < sup; a++){
   max = 0;
   moy = 0;
   for( b = 2; b <= a; b++  ){
     pgcd( a, b, &tmp);
     if ( tmp > max ) max = tmp;
     moy = moy + tmp;
   }
   printf("\n%3d %.2f %3d", a, (float)moy / a, max);
  }
 return 0;
}
