Correct results for part1
Write answers to output file.