modified input method for problem 100