f calculation for first quarter of words in main loop, and passing test case.