/* chksum_ascii.c */
#include <stdio.h>
#define  WID      10   /* characters in 1 column */
#define  LWID    110   /* characters in 1 line   */
#define  ZERO    '0'   /* 0                      */
#define  SPACE   ' '   /* space character        */

main()
{
  unsigned char  line[LWID + 1] ;
  int            i, j ;
  unsigned char  w0[4], w1[4] ;

  for ( i = 0 ; i < 4 ; i++ ) {
    w0[i] = 0 ;
    w1[i] = 0 ;
  }
  j = 0 ;

  while ( fgets( line, LWID + 1, stdin ) != NULL ) {
    for ( i = 0 ; i < strlen(line) ; i++) {
      if ( line[i] != SPACE ) {
        w0[ j & 3      ] += (line[i] - ZERO) ;  /* w0[ j%4   ] */
	w1[(j & 7) >> 1] ^= (line[i] - ZERO) ;  /* w1[(j%8)/2] */
        j++ ;
      }
    }
  }
  fprintf( stdout, "Checksum = %02x%02x%02x%02x, %02x%02x%02x%02x\n",
           w0[0], w0[1], w0[2], w0[3], w1[0], w1[1], w1[2], w1[3] ) ;
  exit(0) ;
}
