#!/usr/bin/perl -w

use v5.36;
use strict;

my @lists = map { eval $_ } grep { length } <>;
say((1 + grep { compare($_, [[2]]) == 1 } @lists)
  * (2 + grep { compare($_, [[6]]) == 1 } @lists));

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

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