use integer;sub f{my($r,$l,$d,$a)=@_;${"@_"}//=$r<3?$l<$d&$d<=$r:do{$a+=f(($r-$_)/5,($l-$_+5)/5-1,$d-$_)for-2..2;$a}}print f<>