3
Jelly, 17 bytes
Ṣ€ṢF
ŒṖÇÐṂ+Z$€L€Ṃ
Try it online!
Alternate version, 15 bytes, postdates challenge
In the latest version, Ɗ combines three links into a monadic chain. This allows the following golf.
ŒṖṢ€ṢFƊÐṂ+ZLƊ€Ṃ
Try it online!
How it works
Ṣ€ṢF Helper link. Argument: P (parti...