Solution to sum of integers in file problem