# [05AB1E](https://github.com/Adriandmen/05AB1E/wiki/Commands), 23 [bytes](https://github.com/Adriandmen/05AB1E/wiki/Codepage) ā<œε©2.ÆíÆ.±Iε®Nèè}«P}O Port of [*@LeakyNun*'s Jelly answer](https://codegolf.stackexchange.com/a/147723/52210). [Try it online](https://tio.run/##yy9OTMpM/f//SKPN0cnnth5aaaR3uO3w2sNteoc2egL56/wOrzi8ovbQ6oBa////o6MNjXUUDM11FIxMYnUUog0tgTwdBWMQW9dUR8FER8EgNhYA) or [verify all but one test cases](https://tio.run/##NVK7bhRBEMz5CuviGmv6MS8EckJCgomQ0OoCkAhIAAkbicABiX@AnzBCIBHAB9xCyi8d1bNHsHs3PdVV1dX79v2Ll69fHT/sHr95d311/2x38fHRs4f3dpfXV6fz8fenB38@//15@KLn6@36bb09P/x4zvP3J@vdendz@Pr05vKIw6@L47Isrvs9zpZFYXssAt@Ogq3gKKj8begYpyuDNKgHfEAmLBU48nZvTZGkKCGBSaPxOATSy0Qaks2a1hNhzkjKV@mYrEiDlVKIqbOnEt4NatTryopaZwtL1h02TjO4KbzALENZ1xbOkw9WKShm0TPiNevOs4dshRQKmky8OSmlgm2aCySHJ20NlmnDq8dg/KP/VYmtFeZUDRq3SuO@aRNde3DAG@cy41DuMYKUEfKklWiavrzDWuZlpTYV3UllynBnhnMhNSOe5DIjYCg0Y22a9MF@okkmsQVX7krL5pP00xgX23psKLibUWSG3pkCn8QWTmEe7iQUlfPJpsfUNydzgEw1xp0smHTwFZc@ZrqxHC5dudMastrQxmQjR40UNCLX6CKJ8OPa/wM) (the biggest test case times out on TIO). **Explanation:** <!-- language-all: lang-python --> ā # Push a list in the range [1, (implicit) input-length] < # Decrease it by 1 to make the range [0, input-length) œ # Get all permutations of this list ε # Map each permutation to: © # Store the permutation in variable `®` (without popping) 2.Æ # Get all 2-element combinations of this list í # Reverse each inner list Æ # Reduce each by subtraction .± # And take their signum (-1 if a<0; 0 if a==0; 1 if a>0) I # Push the input ε # Map each row to: ® # Get the current permutation from variable `®` Nè # Use the map-index to index into this permutation è # And use that to index into the row }« # After the map: merge the two lists together P # And take its product }O # After the outer map: sum all value # (after which it is output implicitly as result)