Simplify a list using path mapper while path_count is not fixed

I am trying to simplify a data tree suing path mapper, the problem is the number of input branches is not fixed, so I need something adaptive, I imagined some formula like in the picture, but it doesn’t work, not sure if it’s even possible to do in path mapper
blue line: number of paths changes for different cases, so I can’s use fixed formula, I need a way to write the formula and make adaptive
thanks in advance

Hello Kinan,
I would not use path mapper for this, because I don’t think i can work with different path lenght, although I am not sure.
If you want to group your branches using only the first number in your path, here is how I would solve this :

First deconstruct your path, then choose the first number and replace the original path with this number.
Is this what you wanted to achieve ?

Have you tried Trim Tree?