Fixed atoi() issue.
Moving from freopen() to FILE for managing input file.