MinDistance (1st task) exceptions for input added