#!/usr/bin/perl -w

use v5.38;

my @times =<>=~ /(\d+)/g;
my @dists =<>=~ /(\d+)/g;

my $res = 1;
while (@times) {
	my $t = shift @times;
	my $d = shift @dists;
	my $n;
	for my $t1 (1 .. $t-1) {
		my $d1 = ($t-$t1)*$t1;
		$n++ if ($d1 > $d);
	}
	$res *= $n;
}

say $res;
