#include <stdio.h>
#include <stdlib.h>
#include <time.h>

int
main(void)
{
	clock_t start = clock();
	size_t sum = 0;

#if 0
	int ch;
	while ((ch = getc(stdin)) != EOF) {
		sum += (unsigned char) ch;
	}
#endif

#if 1
	unsigned char buffer[1024];
	size_t n;
	while ((n = fread(buffer, 1, sizeof buffer, stdin)) > 0) {
		for ( size_t z = 0; z != n; ++z ) {
			sum += buffer[z];
		}
	}
#endif

	clock_t end = clock();

	printf("Result: %zu, Duration: %.3lf sec\n", sum, (double)(end - start) / CLOCKS_PER_SEC);

	return EXIT_SUCCESS;
}
