my @dir=map -> $i { [map $i*$_, 0..3] } 1, 22, 21, 20; my @data=map { split, 0 } =; say reduce -> $a, $b { $a>$b ?? $a !! $b } map -> $base { map -> $offs { [*] map $data[$base+$_], @$offs; } @dir; } 0..@data.something;