print "input the number of lines\n"; $line_n = ; print "input the Xs\n"; for (my $i = 0; $i < $line_n; $i++) { $L[$i] = ; chomp($L[$i]); $L[$i] = $L[$i] - 1; } print "\n"; $Lmax = 1; for (my $i = 0; $i < $line_n; $i++) { if($Lmax < $L[$i]){$Lmax = $L[$i];} } $T[0] = 0; $T[1] = 0; $T[2] = 0; $T[3] = 1; for (my $i = 4; $i <= $Lmax; $i++) { $T[$i] = $T[$i-1] + $T[$i-2] + $T[$i-3] + $T[$i-4]; } for (my $i = 0; $i < $line_n; $i++) { $A[$i] = $T[$L[$i]] % 17; } print "the answer is\n"; for (my $i = 0; $i < $line_n; $i++) { print "$A[$i]\n"; }