import sys

# maximum length of the automaton
length = 50

# define seed
seed = "886442.0..3.5..7.9.9"

# number of generations
generations = 20

# create an array of this length, initialized with -1 (this is used for the '.')
line = [-1] * length

# seed array
n = length / 2 - len(seed) / 2
for c in seed:
	if c == ".":
		line[n] = -1
	else:
		line[n] = int(c)
	n = n + 1

# calculate all generations
for i in range(generations):
	# print current generation
	for i in range(length):
		c = line[i]
		if c == -1:
			sys.stdout.write('.')
		else:
			sys.stdout.write(str(c))
	print
	
	# calculate new line
	newLine = [-1] * length
	for i in range(length):
		c = line[i]
		if c >= 0:
			# calculate update postion
			if c % 2 == 0:
				# even
				ofs = c
			else:
				# odd
				ofs = -c
			
			# update cell
			n = i + ofs
			c = c + 1
			if newLine[n] == -1:
				newLine[n] = c
			else:
				newLine[n] = newLine[n] + c
				
	# fix overflows
	carry = -1
	for i in range(length):
		cell = newLine[i]
		if cell >= 0:
			if cell > 9:
				(cell, nextCarry) = (cell / 10, cell % 10)
			else:
				nextCarry = -1
			if carry >= 0:
				cell = cell + carry
				if cell > 9:
					(cell, rest) = (cell / 10, cell % 10)
					if nextCarry >= 0:
						nextCarry = nextCarry + rest
					else:
						nextCarry = rest
			newLine[i] = cell
			carry = nextCarry
		else:
			if carry >= 0:
				newLine[i] = carry
				carry = -1

	# set new line
	line = newLine
