chomp(my $in = ); my @ans = (); while($in > 1){ if($in == 2){ push @ans, 1; last; }elsif($in == 3){ push @ans, 7; $in -= 3; }elsif($in > 3){ push @ans, 1; $in -= 2; } } my @sorted = sort {$b <=> $a} @ans; print @sorted,"\n";