fix input format
change abs implementation to fabs from math.h 03-7