#!/usr/bin/perl -w

use v5.16;
use strict;

chomp (my @cont = sort { $a <=> $b } <>);

my $count;
sub walk {
	my ($rem, $rest, $used) = @_;
	if (!$rem) {
		$count++;
		say join(',', @$used);
		return;
	}
	return if !@$rest || $rem < $rest->[0];
	for my $i (0 .. $#$rest) {
		my @nr = @$rest;
		my @nu = @$used;
		my (@a) = splice @nr, 0, $i+1;
		my $n = $a[-1];
		push @nu, $n;
		walk($rem - $n, \@nr, \@nu) if $rem >= $n;
	}
}

walk(150, \@cont, []);
say $count;

