Small optimizations in hw1.py

Function multiples._replace_path:
- fix check for insertion of parentheses.

Function multiples.dfa_multiples:
- reduce transitions table by removing checks for '^0$' in the DFA
  itself and move it to the final return statement.

In total: almost 30% weight loss!

Signed-off-by: Andrew Tselischev <andrewtselischev@gmail.com>