#t443. 面积

面积

Area

Problem Background

Special for beginners, ^_^

Problem Description

Write a program to compute the area of the figure enclosed by 1s.

The area is computed by counting the number of intersections of horizontal and vertical lines inside the closed curve formed by 1s.

As shown in the sample data, in a 10×1010\times 10 two-dimensional array, 1s enclose 1515 points, so the area is 1515.

Input Format

A 10×1010\times 10 digit matrix, with a space between digits on each line. The digits are 0 or 1.

Output Format

Output one number: the area of the figure enclosed by 1s in the matrix.

Sample Input 1

0 0 0 0 0 0 0 0 0 0
0 0 0 0 1 1 1 0 0 0
0 0 0 0 1 0 0 1 0 0
0 0 0 0 0 1 0 0 1 0
0 0 1 0 0 0 1 0 1 0
0 1 0 1 0 1 0 0 1 0
0 1 0 0 1 1 0 1 1 0
0 0 1 0 0 0 0 1 0 0
0 0 0 1 1 1 1 1 0 0
0 0 0 0 0 0 0 0 0 0

Sample Output 1

15

Constraints

Time limit 1s, memory limit 1024KiB for each test case.