final version with sample input and output files