#!/usr/bin/perl -w

use v5.36;
use strict;
use experimental 'multidimensional';

my @lists = map { bless $_, 'Sep' } [[2]], [[6]];
push @lists, map { eval $_ } grep { length } <>;
@lists = sort { compare($b, $a) } @lists;

my $m = 1;
for my $i (0 .. $#lists) {
	$m *= $i+1 if ref $lists[$i] eq 'Sep';
}

say $m;

sub compare($l, $r) {
	my $i = 0;
	my $rv = 0;
	while (1) {
		my $lv = $l->[$i];
		my $rv = $r->[$i];

		my $comp;
		if (!defined $lv && defined $rv) {
			return 1;
		} elsif (defined $lv && !defined $rv) {
			return -1;
		} elsif (!defined $lv && !defined $rv) {
			return 0;
		} elsif (ref $lv && ref $rv) {
			$comp = compare($lv, $rv);
		} elsif (ref $lv && !ref $rv) {
			$comp = compare($lv, [$rv]);
		} elsif (!ref $lv && ref $rv) {
			$comp = compare([$lv], $rv);
		} elsif (!ref $lv && !ref $rv) {
			$comp = $rv <=> $lv if $lv != $rv;
		} else {
			die "$lv $rv";
		}
			
		return $comp if defined $comp;
		$i++;
	}
}
			

	
