# PHP, 51 bytes <!-- language: lang-php --> while($d=$argv[++$i])$s+=$x=$d*$x>0?2*$x:$d;echo$s; Run with `-n` or [try it online](http://sandbox.onlinephpfunctions.com/code/9843edffa5bddb9f4a4d9d5957ada0f6f13be38f).