Skip to main content
2 of 2
Commonmark migration

PHP, 51 bytes

while($d=$argv[++$i])$s+=$x=$d*$x>0?2*$x:$d;echo$s;

Run with -n or try it online.

Titus
  • 14.8k
  • 1
  • 24
  • 41