J, 40 37 3732 bytes
my 40 byte expression (1), improved below
u:30+2>.(+:@i.@(2&+)(-*(>+:))"0 _|@i:)47
(1)u:30+2>.(+:@i.@(2&+)(-*(>+:))"0 _|@i:)47
thanks to +Galen Ivanov & +Conor O'Brien for the ideas in their solutions
shorter version including37 included echo statementecho u:32+|.(~.(>:*+:@[-])"0 _])|i:47
echo u:32+|.(~.(>:*+:@[*[+-])"0 _]"{])|i:47
TIO incorporating @FrownyFrog tips from comments