sub decode2 { my ($dc, $next); $_[0] = -$_[0]; $dc -= $_ for @_; # subtract the sum of all elements from the first $_[0] = $dc/@_ - $_[1]; return map { $next += $_ } @_; }