factor out multiplier from case statement
factor out multiplier from case statement

This can be used in other questions too.
dimidd/pgexercises,dimidd/pgexercises,dimidd/pgexercises,dimidd/pgexercises,dimidd/pgexercises