Implemented generalized input function "ReadWithFallback"