read input function