that looks like the code Jochen posted.
$a+$w*$q is the same as $a+($w*$q)
Maybe you can replace $q or $q by $.