#!/usr/bin/perl -w

use v5.16;

my @sig = split //, <>;
pop @sig;

my @mul = qw(0 1 0 -1);
for my $step (1 .. 100) {
	my @sig1;
	for my $i (1 .. @sig) {
		my $sum;
		my @m = map { ($_) x $i } @mul;
		push @m, shift @m;
		# say "$i: mul = ", join(',', @m);
		$sum += $sig[$_] * $m[$_ % @m] for 0 .. $#sig;
		$sum =~ s/.*(.)$/$1/;
		push @sig1, $sum;
	}
	@sig = @sig1;
	say "step $step: ", @sig[0 .. 7];
}

	
