Fixed to output result to file directly.
Because the ELEM value was wrong, the contents of output file was wrong.

Learn, and be careful...
Added isthetime_came function to check the rest-time reached 23.5h.