<Problem>
http://ntucoder.net/Problem/Details/91
Uses Crt;
Var f:array[1..7,1..7] of longint
=((0,0,6,7,6,0,0)
,(0,6,7,8,7,6,0)
,(6,7,8,9,8,7,6)
,(7,8,9,10,9,8,7)
,(6,7,8,9,8,7,6)
,(0,6,7,8,7,6,0)
,(0,0,6,7,6,0,0));
i,j,num:longint;
s:char;
res:longint;
Begin
res:=0; num:=0;
for i:=1 to 7 do
begin
for j:=1 to 7 do
begin
read(s);
if s<>'.' then
begin
num:=ord(s)-ord('0');
inc(res,num*f[i,j]);
end;
end;
readln;
end;
writeln(res);
End.