#!/usr/bin/perl -w

use strict;

my $field = do { local $/; <> };
my $rows = $field =~ s/\s//g;
my $flen = length $field;
my $cols = $flen/$rows;

print "Field has $flen bytes, in $rows rows and $cols cols\n";

my $step = $cols + 2;

my $col = 0;
my $sum = 0;
for my $row (0 .. $rows-1) {
	$sum++ if substr($field, $row*$cols + $col, 1) eq '#';
	$col += 3;
	$col %= $cols;
}
print "sum=$sum\n";

	

