Const
max_length = 10;
type
arr = array [0..max_length, 0..max_length] of byte;
var
a: arr;
i, j, n, m, k, x, y: byte;
c: char;
f: text;
//procedure PrintMatrix(a: arr);
//begin
// for var i := 0 to max_length do
// begin
// writeln;
// for var j := 0 to max_length do
// write(a[i, j], ' ');
// end;
// writeln;
//end;
procedure labirint(i, j: byte);
begin
if (i <= n) and (i >= 0) and (j <= m) and (j >= 0) and (a[i, j] = 0) then begin
a[i, j] := 1;
k := k + 1;
labirint(i, j - 1);
labirint(i, j + 1);
labirint(i - 1, j);
labirint(i + 1, j);
end;
end;
begin
Assign(f, 'input.txt');
Reset(f);
readln(f, n, m);
for i := 0 to n do
begin
for j := 0 to m do
begin
read(f, c);
case c of
'x': a[i, j] := 2;
'.': a[i, j] := 0;
'+':
begin
x := i;
y := j;
a[i, j] := 0;
end;
end;
end;
readln(f);
end;
Close(f);
// PrintMatrix(a);
labirint(x, y);
writeln(k);
// PrintMatrix(a);
end.