n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
right=[0 for i in range(n+1)]
left=[0 for i in range(n+1)]
d={}
for j in range(len(b)):
	d[b[j]]=j
for i in range(n):
	k=d[a[i]]-i
	if(k>=0):
		right[k]=right[k]+1
		left[(n-k)]=left[(n-k)]+1
	else:
		left[abs(k)]=left[abs(k)]+1
		right[(n-abs(k))]=right[(n-abs(k))%n]+1
print(max(max(right),max(left)))


n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
right=[0 for i in range(n)]
left=[0 for i in range(n)]
for i in range(len(a)):
	k=i-b.index(a[i])
	if k<0:
		right[abs(k)%n]=right[abs(k)%n]+1
		left[(n-abs(k))%n]=left[(n-abs(k))%n]+1
	else:
		left[(abs(k))%n]=left[(abs(k))%n]+1
		right[(n-abs(k))%n]=right[(n-abs(k))%n]+1
print(max(max(left),max(right)))


n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
ind = a.index(b[0])
a = a[ind:]+a[:ind]
c = 0
for i,j in zip(a,b):
  if i==j:
    c+=1
print(c)


from collections import defaultdict
n = int(input())
a = list(map(int,input().split()))
b = dict()
for i,x in enumerate(list(map(int,input().split()))):
  b[x] = i
res = defaultdict(lambda:0)
for i,e in enumerate(a):
  diff = i-b[e]
  if diff < 0:
    diff += n
  res[diff]+=1
print(max(res.values()))


from collections import defaultdict
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
dp = defaultdict(lambda : 0) ; temp = [0]*(n+1)
for i in range(n):
    temp[a[i]] = i
for i,v in enumerate(b):
    cur = temp[v] - i
    if(cur < 0): cur+=n
    dp[cur]+=1
ans = 0
for i , j in dp.items():
    ans = max(ans ,j)
print(ans)


from collections import defaultdict
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
dp = defaultdict(lambda : 0) ; temp = [0]*(n+1)
for i in range(n):
    temp[a[i]] = i
for i,v in enumerate(b):
    cur = temp[v] - i
    if(cur < 0): cur+=n
    dp[cur]+=1
ans = 0
for i , j in dp.items():
    ans = max(ans ,j)
print(j)


from collections import Counter
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
f1 = {}; f2 = {}
for i in range(n):
    f1[a[i]] = i
for i in range(n):
    f2[b[i]] = i

checker = {}
for i in range(1,n+1):
    if(f1[i]<=f2[i]):
        checker[i] = f2[i] - f1[i]
    else:
        checker[i] = n - f1[i] + f2[i]

mx = Counter(list(checker.values()))
ans = max(mx.values())
print(ans)


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
x = [0 for i in range(n+1)]; y = [0 for i in range(n+1)]; z = [0 for i in range(2*n+10)]

for i in range(n):
    x[a[i]] = i+1

for i in range(n):
    y[b[i]] = i+1

for i in range(1,n+1):
    if(x[i]-y[i]>0):
        z[x[i]-y[i]+1]+=1
    else:
        z[x[i]-y[i]+n+1]+=1

ans = 0
for i in z:
    ans = max(ans, i)
print(ans)


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
i = 0; mx = 0;
while(i<=n):
    temp = 0
    for j in range(n):
        if(a[j]==b[j]):
            temp+=1
    #print(temp)
    mx = max(mx, temp)
    b = b[1:] + [b[0]]
    #print(b)
    i+=1
print(mx)


a = [0 for y in range(200001)]
b = [0 for y in range(200001)]
n = int(input())
m=-1
temp = input().split()
for i in range(0, n):
	a[int(temp[i])] = i
temp = input().split()
for i in range(0, n):
  l = (n + a[int(temp[i])] - i) % n
  b[l] += 1
  m = max(m, b[l])
print(m)


a = [0 for y in range(200000)]
b = [0 for y in range(200000)]
n = int(input())
m=-1
temp = input().split()
for i in range(0, n):
	a[int(temp[i])] = i
temp = input().split()
for i in range(0, n):
  l = (n + a[int(temp[i])] - i) % n
  b[l] += 1
  m = max(m, b[l])
print(m)


"""
  ____          _      _____
 / ___|___   __| | ___|  ___|__  _ __ ___ ___  ___
| |   / _ \ / _` |/ _ \ |_ / _ \| '__/ __/ _ \/ __|
| |__| (_) | (_| |  __/  _| (_) | | | (_|  __/\__ \
 \____\___/ \__,_|\___|_|  \___/|_|  \___\___||___/

"""
"""
░░██▄░░░░░░░░░░░▄██
░▄▀░█▄░░░░░░░░▄█░░█░
░█░▄░█▄░░░░░░▄█░▄░█░
░█░██████████████▄█░
░█████▀▀████▀▀█████░
▄█▀█▀░░░████░░░▀▀███
██░░▀████▀▀████▀░░██
██░░░░█▀░░░░▀█░░░░██
███▄░░░░░░░░░░░░▄███
░▀███▄░░████░░▄███▀░
░░░▀██▄░▀██▀░▄██▀░░░
░░░░░░▀██████▀░░░░░░
░░░░░░░░░░░░░░░░░░░░
"""

import sys
import math
import collections
from collections import deque

#sys.stdin = open('input.txt', 'r')
#sys.stdout = open('output.txt', 'w')

from functools import reduce
from sys import stdin, stdout, setrecursionlimit
setrecursionlimit(2**20)

def isPowerOfTwo(x):
    return (x and (not(x & (x - 1))))

def factors(n):
    return list(set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n**0.5) + 1) if n % i == 0))))

T = 1
T = int(stdin.readline())
for _ in range(T):
    #s = str(stdin.readline().strip('\n'))
    #a, b = list(map(int, stdin.readline().split()))
    #s = list(stdin.readline().strip('\n'))
    #b = list(stdin.readline().strip('\n'))
    n = int(stdin.readline())
    #n, m = list(map(int, stdin.readline().split()))
    a = list(map(int, stdin.readline().split()))
    b = list(map(int, stdin.readline().split()))
    ai = [0] * (n + 1)
    bi = [0] * (n + 1)
    for i in range(n):
        ai[a[i]] = i
        bi[b[i]] = i
    #print(a, b)
    d = {}
    for k in range(1, n + 1):
        sft = ai[k] - bi[k]
        if sft >= 0:
            if sft not in d:
                d[sft] = 0
            d[sft] += 1
        else:
            if n - abs(sft) not in d:
                d[n - abs(sft)] = 0
            d[n - abs(sft)] += 1
    print(max(d.values()))


"""
  ____          _      _____
 / ___|___   __| | ___|  ___|__  _ __ ___ ___  ___
| |   / _ \ / _` |/ _ \ |_ / _ \| '__/ __/ _ \/ __|
| |__| (_) | (_| |  __/  _| (_) | | | (_|  __/\__ \
 \____\___/ \__,_|\___|_|  \___/|_|  \___\___||___/

"""
"""
░░██▄░░░░░░░░░░░▄██
░▄▀░█▄░░░░░░░░▄█░░█░
░█░▄░█▄░░░░░░▄█░▄░█░
░█░██████████████▄█░
░█████▀▀████▀▀█████░
▄█▀█▀░░░████░░░▀▀███
██░░▀████▀▀████▀░░██
██░░░░█▀░░░░▀█░░░░██
███▄░░░░░░░░░░░░▄███
░▀███▄░░████░░▄███▀░
░░░▀██▄░▀██▀░▄██▀░░░
░░░░░░▀██████▀░░░░░░
░░░░░░░░░░░░░░░░░░░░
"""

import sys
import math
import collections
from collections import deque

#sys.stdin = open('input.txt', 'r')
#sys.stdout = open('output.txt', 'w')

from functools import reduce
from sys import stdin, stdout, setrecursionlimit
setrecursionlimit(2**20)

def isPowerOfTwo(x):
    return (x and (not(x & (x - 1))))

def factors(n):
    return list(set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n**0.5) + 1) if n % i == 0))))

T = 1
#T = int(stdin.readline())
for _ in range(T):
    #s = str(stdin.readline().strip('\n'))
    #a, b = list(map(int, stdin.readline().split()))
    #s = list(stdin.readline().strip('\n'))
    #b = list(stdin.readline().strip('\n'))
    n = int(stdin.readline())
    #n, m = list(map(int, stdin.readline().split()))
    a = list(map(int, stdin.readline().split()))
    b = list(map(int, stdin.readline().split()))
    ai = [0] * (n + 1)
    bi = [0] * (n + 1)
    for i in range(n):
        ai[a[i]] = i
        bi[b[i]] = i
    #print(a, b)
    d = {}
    for k in range(1, n + 1):
        sft = ai[k] - bi[k]
        if sft >= 0:
            if sft not in d:
                d[sft] = 0
            d[sft] += 1
        else:
            if n - abs(sft) not in d:
                d[n - abs(sft)] = 0
            d[n - abs(sft)] += 1
    print(max(d.values()))


t=int(input())
s1=list(map(int,input().split()))
s2=list(map(int,input().split()))
if t==1:
    print(1)
else:
    dic={}
    l1=[]
    for i in range(t):
     if s2.index(s1[i])-i<0:
        ans=t+s2.index(s1[i])-i
     else:
        ans=s2.index(s1[i])-i
     if ans not in dic:
        dic[ans]=1
     else:
        dic[ans]+=1
    print(max(dic.values()))


t=int(input())
s1=list(map(int,input().split()))
s2=list(map(int,input().split()))
as1=[]*(t+1)
as2=[]*(t+1)
for j in range(t):
    as1[s1[j]]=j
for k in range(t):
    as2[s2[k]]=k
dic={}
l1=[]
ma=1
for i in range(1,t+1):
    if as2[i]<as1[i]:
        ans=t-as2[i]+as1[s1]
    else:
        ans=as2[i]-as1[i]
    if ans not in dic:
        dic[ans]=1

    else:
        dic[ans]+=1
        ma=max(dic[ans],ma)
print(ma)


t=int(input())
s1=list(map(int,input().split()))
s2=list(map(int,input().split()))
if t==1:
    print(1)
else:
    l1=[]
    for i in range(t):
     if s2.index(s1[i])-i<0:
        l1.append(t+s2.index(s1[i])-i)
     else:
        l1.append(s2.index(s1[i])-i)
    l1.sort()
    l2=[]
    s=1
    for r in range(0,len(l1)-1):
        if l1[r]==l1[r+1]:
           s+=1
        else:
           l2.append(s)
           s=1
    if l1[-2]==l1[-1]:
        l2.append(s)
    else:
        l2.append(1)
    l2.sort()
    print(l2[-1])


t=int(input())
s1=list(map(int,input().split()))
s2=list(map(int,input().split()))
as1=[0]*(t+1)
as2=[0]*(t+1)
for j in range(t):
    as1[s1[j]]=j
for k in range(t):
    as2[s2[k]]=k
dic={}
l1=[]
ma=1
for i in range(1,t+1):
    if as2[i]<as1[i]:
        ans=t+as2[i]-as1[i]
    else:
        ans=as2[i]-as1[i]
    if ans not in dic:
        dic[ans]=1
    else:
        dic[ans]+=1
        ma=max(dic[ans],ma)
print(ma)


t=int(input())
s1=list(map(int,input().split()))
s2=list(map(int,input().split()))
if t==1:
    print(1)
else:
    dic={}
    l1=[]
    ma=1
    for i in range(t):
     if s2.index(s1[i])-i<0:
        ans=t+s2.index(s1[i])-i
     else:
        ans=s2.index(s1[i])-i
     if ans not in dic:
        dic[ans]=1

     else:
        dic[ans]+=1
        ma=max(dic[ans],ma)
    print(ma)


t=int(input())
s1=list(map(int,input().split()))
s2=list(map(int,input().split()))
as1=[0]*(t+1)
as2=[0]*(t+1)
for j in range(t):
    as1[s1[j]]=j
for k in range(t):
    as2[s2[k]]=k
dic={}
l1=[]
ma=1
for i in range(1,t+1):
    if as2[i]<as1[i]:
        ans=t-as2[i]+as1[i]
    else:
        ans=as2[i]-as1[i]
    if ans not in dic:
        dic[ans]=1

    else:
        dic[ans]+=1
        ma=max(dic[ans],ma)
print(ma)


n = int(input())
l1 = list(map(int,input().split()))
l2 = list(map(int,input().split()))
r = l1[0]

t = l2.index(l1[0])

l2 = list(l2[t:] + l2[:t])
d1 = {}
d2 = {}
count = 0
for i in range(n):

	if l1[i] == l2[i]:
		count = count + 1
print(count)


n=int(input())
arr=list(map(int,input().strip().split()))
brr=list(map(int,input().strip().split()))
d=dict()
for i in range(1,n+1):
    d[i]=0
for j in range(n):
    num=brr[j]
    for k in range(n):
        if(num==arr[k]):
            if(k<=j):
                t=n-j+k
                d[t]=d[t]+1
            elif(k>j):
                t=k-j
                d[t]=d[t]+1
out=0
for i in range(1,n+1):
    if(d[i]>=out):
        out=d[i]
print(out)


n=int(input())
arr=list(map(int,input().strip().split()))
brr=list(map(int,input().strip().split()))
d=dict()
for i in range(1,n+1):
    d[i]=0
crr=[]
drr=[]
for i in range(n):
    crr.append(i)
    crr.append(arr[i])
    drr.append(crr)
    crr=[]
err=[]
frr=[]
for i in range(n):
    err.append(i)
    err.append(brr[i])
    frr.append(err)
    err=[]
drr=sorted(drr,key=lambda drr:drr[1])
frr=sorted(frr,key=lambda frr:frr[1])
for i in range(n):
    j=frr[i][0]
    k=drr[i][0]
    if(k<=j):
        t=n-j+k
        d[t]=d[t]+1
    elif(k>j):
        t=k-j
        d[t]=d[t]+1
out=0
for i in range(1,n+1):
    if(d[i]>=out):
        out=d[i]
print(out)


using System;
using System.Collections.Generic;
using System.IO;
using System.Text;

namespace Serial_Time
{
    internal class Program
    {
        private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);
        private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);

        private static void Main(string[] args)
        {
            int k = Next();
            int n = Next();
            int m = Next();

            var nn = new int[k + 2,n + 2,m + 2];
            for (int i = 1; i <= k; i++)
            {
                for (int j = 1; j <= n; j++)
                {
                    for (int l = 1; l <= m; l++)
                    {
                        nn[i, j, l] = Next();
                    }
                }
            }
            int a = Next();
            int b = Next();
            int count = 0;

            var dx = new[] {0, 0, 0, 0, 1, -1};
            var dy = new[] {0, 0, 1, -1, 0, 0};
            var dz = new[] {1, -1, 0, 0, 0, 0};

            var q = new Queue<Tuple<int, int, int>>();
            q.Enqueue(new Tuple<int, int, int>(1, a, b));
            while (q.Count > 0)
            {
                Tuple<int, int, int> d = q.Dequeue();
                if (nn[d.Item1, d.Item2, d.Item3] != 1)
                    continue;
                nn[d.Item1, d.Item2, d.Item3] = 2;
                count++;

                for (int i = 0; i < dx.Length; i++)
                {
                    q.Enqueue(new Tuple<int, int, int>(d.Item1 + dx[i], d.Item2 + dy[i], d.Item3 + dz[i]));
                }
            }

            writer.WriteLine(count);
            writer.Flush();
        }

        private static int Next()
        {
            int c;
            do
            {
                c = reader.Read();
                if (c == '.')
                    return 1;
                if (c == '#')
                    return 0;
            } while (c < '0' || c > '9');
            int res = c - '0';
            while (true)
            {
                c = reader.Read();
                if (c < '0' || c > '9')
                    return res;
                res *= 10;
                res += c - '0';
            }
        }
    }
}


import java.lang.Math.pow
import java.lang.String.format
import java.util.*
import kotlin.math.*
import kotlin.system.exitProcess

private fun readLn() = readLine()!! // string line
private fun readInt() = readLn().toInt() // single int
private fun readStrings() = readLn().split(" ") // list of strings
private fun readInts() = readStrings().map { it.toInt() } // list of ints
private fun readLongs() = readStrings().map { it.toLong() } // list of ints

var k = 0
var n = 0
var m = 0
var arr = arrayOf<Array<Array<Boolean>>>()
var visited = arrayOf<Array<Array<Boolean>>>()
var total = 0

fun main() {
    val (k1, n1, m1) = readInts()
    n = n1; k = k1; m = m1

    for (ki in 0 until k) {
        var arr2D = arrayOf<Array<Boolean>>()
        for (ni in 0 until n) {
            var arr1D = arrayOf<Boolean>()
            for (mi in 0 until m) {
                arr1D += false
            }
            arr2D += arr1D
        }
        visited += arr2D
    }

    for (ki in 0 until k) {
        readLn()
        var arr2D = arrayOf<Array<Boolean>>()
        for (ni in 0 until n) {
            val s = readLn()
            var arr1D = arrayOf<Boolean>()
            for (mi in 0 until m) {
                arr1D += s[mi] == '.'
            }
            arr2D += arr1D
        }
        arr += arr2D
    }

    readLn()
    val (x, y) = readInts()

    dfs(0, x - 1, y - 1)
    print(total)
}

fun dfs(z: Int, x: Int, y: Int) {
    if (z < 0 || x < 0 || y < 0) {
        return
    }

    if (z == k || x == n || y == m) {
        return
    }

    if (visited[z][x][y]) {
        return
    }

    if (!arr[z][x][y]) {
        return
    }

    visited[z][x][y] = true
    total++

    dfs(z, x, y+1)
    dfs(z, x, y-1)
    dfs(z, x+1, y)
    dfs(z, x-1, y)
    dfs(z+1, x, y)
    dfs(z-1, x, y)
}


#include <bits/stdc++.h>
using namespace std;

char grid[15][15][15];
int k, n, m;
int dz[]={ 0, 0, 0, 0,-1, 1};
int dx[]={-1, 0, 1, 0, 0, 0};
int dy[]={ 0,-1, 0, 1, 0, 0};

int dfs(int z, int x, int y){
	if(z<0 || z>=k) return 0;
	if(x<0 || x>=n) return 0;
	if(y<0 || y>=m) return 0;
	if(grid[z][x][y]!='.') return 0;
	grid[z][x][y]=0;
	int ans=1;
	for(int i=0; i<6; i++)
		ans+=dfs(z+dz[i], x+dx[i], y+dy[i]);
	return ans;
}

int main(){

	cin>>k>>n>>m;

	memset(grid, 0, sizeof grid);
	for(int i=0; i<k; i++)
		for(int j=0; j<n; j++)
			scanf("%s", grid[i][j]);

	int x, y;
	cin>>x>>y;
	cout<<dfs(0, x-1, y-1)<<endl;

	return 0;
}


#include <cctype>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <bitset>
#include <deque>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <tr1/unordered_map>
#include <tr1/unordered_set>
#define ss(x)	cout<<"DEBUG : "#x" = "<<(x)<<"\n"
#define fi		first
#define se		second
#define sz		size()
#define fo(i,n) for(int i=0;i<(n);++i)
#define pv(i,n)	((i)>0?(i)-1:(n)-1)
#define nx(i,n)	((i)+1<(n)?(i)+1:0)
#define umap	tr1::unordered_map
#define uset	tr1::unordered_set
#define TT		template<typename T>
#define TAB		template<typename A,typename B>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
TT T abs(const T& x) { return x<0?-x:x; }
TT T sq(const T& x) { return x*x; }
TT void mil(T& a,const T& b) { if(a>b)a=b; }
TT void mal(T& a,const T& b) { if(a<b)a=b; }
TT void usort(vector<T>& a) { sort(a.begin(),a.end());a.erase(unique(a.begin(),a.end()),a.end()); }
TT T gcd(T a,T b) { while(b!=0){T t=a%b;a=b;b=t;} return a; }
TT pair<T,T> operator+(const pair<T,T>& a,const pair<T,T>& b) { return pair<T,T>(a.first+b.first,a.second+b.second); }
TT pair<T,T> operator-(const pair<T,T>& a,const pair<T,T>& b) { return pair<T,T>(a.first-b.first,a.second-b.second); }
TAB istream& operator>>(istream& i,pair<A,B>& v) { return i>>v.first>>v.second; }
TAB B conv(const A& i) { stringstream s;s<<i;B o;s>>o;return o; }
ll cross(const pii& a,const pii& b) { return (ll)a.first*b.second-(ll)b.first*a.second; }
ll dot(const pii& a,const pii& b) { return (ll)a.first*b.first+(ll)a.second*b.second; }

char mat[16][16][16];
int cnt;
int dr[6][3]={{0,0,1},{0,0,-1},{0,1,0},{0,-1,0},{1,0,0},{-1,0,0}};

void dfs(int a,int b,int c)
{
	++cnt;
	mat[a][b][c]='@';
	fo(i,6)
	{
		if(mat[dr[i][0]+a][dr[i][1]+b][dr[i][2]+c]=='.')
			dfs(dr[i][0]+a,dr[i][1]+b,dr[i][2]+c);
	}
}

void york()
{
	int l,n,m;
	cin>>l>>n>>m;
	for(int i=1;i<=l;++i)
		for(int j=1;j<=n;++j)cin>>&mat[i][j][1];
	int x,y;
	cin>>x>>y;
	dfs(1,x,y);
	cout<<cnt;
}

int main()
{
	ios_base::sync_with_stdio(false);
#ifndef ONLINE_JUDGE
	freopen("1.txt","r",stdin);
#endif
	york();
	return 0;
}


//ITNOG
#include <bits/stdc++.h>

using namespace std;
#define int long long

const int maxN = 100*1000 + 5;
const int mod = 1000*1000*1000 + 7;
pair<int, string> a[maxN];
pair<int, string> b[maxN];
int c[maxN];
int n, m;
string tmp;
bool cmp(pair<int, string> x, pair<int, string> y)
{
    if(x.first == y.first) return (x.second > y.second);
    return (x.first < y.first);
}
int solve1()
{
    for(int i = 0; i < n; i ++) b[i] = a[i];
    sort(b, b + n, cmp);
    for(int i = 0; i < n; i ++)
	  if(b[i].second == tmp) b[i].first += c[m - 1];

    int st = 0, cnt = 0;

    while(cnt < m - 1)
    {
	  if(b[st].second == tmp) { st ++; continue; }
	  b[st].first += c[m - 2 - cnt];
	  st ++; cnt ++;
    }
    sort(b, b + n, cmp);
    // for(int i = 0; i < n; i ++)
    //  cout << b[i].second << ' ' << b[i].first << endl;
    for(int i = 0; i < n; i ++)
	  if(b[i].second == tmp) return n - i;
}
int solve2()
{
    for(int i = 0; i < n; i ++) b[i] = a[i];
    sort(b, b + n);

    int st = n - 1, cnt = 0;
    while(cnt < m && st > -1)
    {
	  if(b[st].second == tmp) { st --; continue; }
	  b[st].first += c[m - 1 - cnt];
	  st --; cnt ++;
    }
    if(cnt < m)
    {
	  for(int i = 0; i < n; i ++) if(b[i].second == tmp) b[i].first += c[0];
    }

    sort(b, b + n, cmp);
    for(int i = 0; i < n; i ++)
	  if(b[i].second == tmp) return n - i;
}
main()
{
    ios::sync_with_stdio(0); cin.tie(0);
    cin >> n;
    for(int i = 0; i < n; i ++)
	  cin >> a[i].second >> a[i].first;

    cin >> m;
    for(int i = 0; i < m; i ++) cin >> c[i];
    sort(c, c + m);
    cin >> tmp;
    if(!m)
    {
	  sort(a, a + n);
	  for(int i = 0; i < n; i ++) if(a[i].second == tmp) { cout << i + 1 << ' ' << i + 1 << endl; return 0; }
    }
    cout << solve1() << ' ' << solve2() << endl;
    return 0;

}


//ITNOG
#include<bits/stdc++.h>

using namespace std;
#define X first
#define Y second

const int maxN = 10 + 5;
char a[maxN][maxN][maxN];
int mark[maxN][maxN][maxN];
int k, n, m;
int dx[] = {-1, 1, 0, 0, 0, 0};
int dy[] = {0, 0, -1, 1, 0, 0};
int dz[] = {0, 0, 0, 0, -1, 1};
int cnt;
void dfs(int x, int y, int z)
{
    //cout << x << ' ' << y << ' ' << z << endl;
    mark[x][y][z] = 1; cnt ++;
    for(int i = 0; i < 6; i ++)
    {
	  int r = x + dx[i], c = y + dy[i], t = z + dz[i];
	  if(r < 0 || c < 0 || t < 0) continue;
	  if(r >= k || c >= n || t >= m) continue;
	  if(!mark[r][c][t] && a[r][c][t] == '.')
		dfs(r, c, t);
    }

}
int main()
{
    ios::sync_with_stdio(0); cin.tie(0);
    cin >> k >> n >> m;
    for(int i = 0; i < k; i ++)
	  for(int j = 0; j < n; j ++)
		for(int t = 0; t < m; t ++)
		    cin >> a[i][j][t];
    int x, y; cin >> x >> y; x --; y --;
    dfs(0, x, y);
    cout << cnt << endl;
    return 0;
}


/***************************************************************************************/
//                                In The name of GOD                                   //
//                     (*(*(*   SaDrA  (SADDAS)  DaShTi   *)*)*)                       //
/***************************************************************************************/
#include <iostream>
#include <cstdio>
#include <sstream>
#include <fstream>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <string>
#include <map>
#include <set>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <stack>
#include <iomanip>

#define pb push_back
#define pp pop_back
#define ff first
#define ss second
#define mp make_pair
#define m0(x) memset(x,0,sizeof(x))
#define m1(x) memset(x,-1,sizeof(x))
#define rep(i,j,k) for (int i = j; i <= k; i++)
#define mrep(i,j,k) for (int i = j; i >= k; i--)
#define inf 1000000007 // 10^9
#define M 1000007      // 10^6
#define N 100007       // 10^5
#define max(a, b)  (a < b ? b : a)
#define min(a, b)  (a > b ? b : a)
#define sz(x) (((int)x.size()))

using namespace std;

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef vector<pair<int,int> > vii;
typedef pair<ll,ll> pll;

int n,m,k;
bool vis[12][12][12],a[12][12][12];
int x1[] = {0,0,0,0,-1,1};
int x2[] = {1,-1,0,0,0,0};
int x3[] = {0,0,-1,1,0,0};
void dfs(int x,int y, int z)
{
    vis[x][y][z] = true;
    rep(i,0,5)
    {
        if (!vis[x+x1[i]][y+x2[i]][z+x3[i]] && !a[x+x1[i]][y+x2[i]][z+x3[i]])
            dfs(x+x1[i],y+x2[i],z+x3[i]);
    }
}
int main()
{
    /**************************************/
    ios_base::sync_with_stdio(0);cin.tie(0);
    /**************************************/

    cin >> k >> n >> m;
    rep(i,1,k)
    rep(j,1,n)
    rep(f,1,m)
    {
        char c; cin >> c;
        if (c == '#')
            a[i][j][f] = 1;
    }
    rep(i,0,10) rep(j,0,10)
        a[0][i][j] = a[i][j][0] = a[i][0][j] = a[k+1][i][j] = a[i][j][m+1] = a[i][n+1][j] = 1;
    int x0,y0; cin >> x0 >> y0;
    dfs(1,x0,y0);
    int ans = 0;
    rep(i,1,k) rep(j,1,n) rep(f,1,m)
    {
        if (vis[i][j][f])
            ans ++;
    }
    cout << ans;
}


//by maximumSHOT

#define _USE_MATH_DEFINES

#include <iostream>
#include <cmath>
#include <math.h>
#include <vector>
#include <algorithm>
#include <string>
#include <cstring>
#include <queue>
#include <map>
#include <set>
#include <time.h>
#include <clocale>
#include <fstream>
#include <conio.h>
#include <random>
#include <bitset>

using namespace std;

#define forx(i,n) for(int i(0);i < n;i++)
#define vec vector
#define mp make_pair
#define ALL(x) (x).begin(), (x).end()

typedef long L;
typedef long long LL;
typedef pair<LL, LL> pll;
typedef long double LD;
typedef vector<int> vint;
typedef vec<LL> vll;
typedef vector<vint> vvint;
typedef vector<double> vdouble;
typedef vector<vector<double>> vvdouble;
typedef vec<bool> vbool;
typedef vec<vec<bool>> vvbool;
typedef pair<int,int> pii;
typedef pair<double,double> pdd;
typedef pair<double,int> pdi;
typedef pair<int,double> pid;
typedef unsigned long long ull;
typedef unsigned int ui;
const int inf = 1000 * 1000 * 1000;
const LL inf64 = LL(inf) * inf;
const LL base  = 1e9+7;
const double pi = acos(-1.0);
inline LL Sqr(LL a){return a*a;}
struct Tripple
{
    int first;
    int second;
    int third;

    void make_tripple(int a,int b,int c)
    {
        first  = a;
        second = b;
        third  = c;
    }
};
bool cmp1(Tripple a,Tripple b)
{
    return a.first < b.first;
}
bool cmp2(Tripple a,Tripple b)
{
    return a.second < b.second;
}
bool cmp3(Tripple a,Tripple b)
{
    return a.third < b.third;
}

// GL begin

vec<set<int>> g;
vbool used;
int ans = 0;

// GL end

//Functions begin

void dfs(int v)
{
    used[v] = 1;
    int nn = (int)g[v].size();
    ans++;
    for(set<int>::iterator i = g[v].begin();i != g[v].end();i++) if(!used[*i]) dfs(*i);
}

//Functions end

bool solve()
{
    ios_base::sync_with_stdio(0);
    setlocale(LC_ALL, "Russian");
    ifstream fin("input.txt");
    ofstream fout("output.txt");
    //#define cin fin
    //#define cout fout

    int k, n, m;
    cin >> k >> n >> m;

    vec<vec<string>> a(k, vec<string>(n));

    for(int i(0);i < k;i++) for(int j(0);j < n;j++) cin >> a[i][j];

    g.resize(k * n * m);
    used.assign(k * n * m, false);

    for(int i(0);i < k;i++)
    {
        for(int j(0);j < n;j++)
        {
            for(int z(0);z < m;z++)
            {
                //cout << i * n * m + j * m + z << ' ';
                if(a[i][j][z] == '#') continue;

                if(i >  0)
                    if(a[i - 1][j][z] == '.')
                        g[i * n * m + j * m + z].insert((i - 1) * n * m + j * m + z),
                        g[(i - 1) * n * m + j * m + z].insert(i * n * m + j * m + z);
                if(i < k - 1)
                    if(a[i + 1][j][z] == '.')
                        g[i * n * m + j * m + z].insert((i + 1) * n * m + j * m + z),
                        g[(i + 1) * n * m + j * m + z].insert(i * n * m + j * m + z);
                if(j > 0)
                    if(a[i][j - 1][z] == '.')
                        g[i * n * m + j * m + z].insert(i * n * m + (j - 1) * m + z),
                        g[i * n * m + (j - 1) * m + z].insert(i * n * m + j * m + z);
                if(j < n - 1)
                    if(a[i][j + 1][z] == '.')
                        g[i * n * m + j * m + z].insert(i * n * m + (j + 1) * m + z),
                        g[i * n * m + (j + 1) * m + z].insert(i * n * m + j * m + z);
                if(z > 0)
                    if(a[i][j][z - 1] == '.')
                        g[i * n * m + j * m + z].insert(i * n * m + j * m + z - 1),
                        g[i * n * m + j * m + z - 1].insert(i * n * m + j * m + z);
                if(z < m - 1)
                    if(a[i][j][z + 1] == '.')
                        g[i * n * m + j * m + z].insert(i * n * m + j * m + z + 1),
                        g[i * n * m + j * m + z + 1].insert(i * n * m + j * m + z);
            }
            //cout << '\n';
        }
        //cout << "--------\n";
    }

    int x, y;
    cin >> x >> y;
    x--, y--;

    dfs(x * m + y);

    cout << ans << '\n';

    //_getch();
    return true;
}

int main(int argc,char **argv)
{
    //while(solve());
    solve();

    return 0;
}


#include <cstdio>
#include <sstream>
#include <cstdlib>
#include <cctype>
#include <cmath>
#include <algorithm>
#include <set>
#include <queue>
#include <stack>
#include <list>
#include <iostream>
#include <fstream>
#include <numeric>
#include <string>
#include <vector>
#include <cstring>
#include <map>
#include <tuple>
#include <iterator>

using namespace std;

typedef long long ll;
typedef unsigned int ul;
typedef unsigned long long ull;
typedef vector <int> vi;
typedef set<int> si;
typedef set<string> ss;
typedef map<string,int>	msi;
typedef map<string,string> mss;
typedef map<int, vector<int> > mvii;
typedef map<string, vector <string> > mvss;
typedef map<char,int> mchi;
typedef map<int,char> mich;
typedef map<int, int> mii;
typedef queue <int> qi;
typedef map <int, vector<string> > mvis;
typedef map <string, vector<int> > mvsi;
typedef vector <string> vs;
typedef pair <int, int> pii;

#define MP make_pair
#define SORT(a) sort (a.begin(), a.end())
#define REVERSE(a) reverse (a.begin(), a.end())
#define PI acos(-1)
#define ms(x,y) memset (x, y, sizeof x)
#define INF 2000000
#define pb push_back
#define MAX 1000005

string plate[20][20];
int k, n, m; //d[20][20][20];
bool visited[20][20][20];

bool check(int a, int b, int c)
{
	if (a>=0 && a<k && b>=0 && b<n && c>=0 && c<m)
		return true;
	return false;
}

int BFS(int p, int q, int r)
{
	int cnt=0;
	qi Q;
	Q.push(p);
	Q.push(q);
	Q.push(r);
	ms(visited,0);
	visited[p][q][r]=true;
	while (!Q.empty())
	{
		int u=Q.front();
		Q.pop();
		int v=Q.front();
		Q.pop();
		int w=Q.front();
		Q.pop();
		if (check(u,v,w+1) && !visited[u][v][w+1] && plate[u][v][w+1]=='.')
		{
			visited[u][v][w+1]=true;
			//~ d[u][v][w+1]=d[u][v][w]+1;
			Q.push(u);
			Q.push(v);
			Q.push(w+1);
		}
		if (check(u,v,w-1) && !visited[u][v][w-1] && plate[u][v][w-1]=='.')
		{
			visited[u][v][w-1]=true;
			//~ d[u][v][w-1]=d[u][v][w]+1;
			Q.push(u);
			Q.push(v);
			Q.push(w-1);
		}
		if (check(u,v+1,w) && !visited[u][v+1][w] && plate[u][v+1][w]=='.')
		{
			visited[u][v+1][w]=true;
			//~ d[u][v+1][w]=d[u][v][w]+1;
			Q.push(u);
			Q.push(v+1);
			Q.push(w);
		}
		if (check(u,v-1,w) && !visited[u][v-1][w] && plate[u][v-1][w]=='.')
		{
			visited[u][v-1][w]=true;
			//~ d[u][v-1][w]=d[u][v][w]+1;
			Q.push(u);
			Q.push(v-1);
			Q.push(w);
		}
		if (check(u+1,v,w) && !visited[u+1][v][w] && plate[u+1][v][w]=='.')
		{
			visited[u+1][v][w]=true;
			//~ d[u+1][v][w]=d[u][v][w]+1;
			Q.push(u+1);
			Q.push(v);
			Q.push(w);
		}
		if (check(u-1,v,w) && !visited[u-1][v][w] && plate[u-1][v][w]=='.')
		{
			visited[u-1][v][w]=true;
			//~ d[u-1][v][w]=d[u][v][w]+1;
			Q.push(u-1);
			Q.push(v);
			Q.push(w);
		}
		cnt++;
	}
	return cnt;
}

int main()
{
	int x, y;
	cin>>k>>n>>m;
	for (int i=0; i<k; i++)
	{
		for (int j=0; j<n; j++)
		{
			cin>>plate[i][j];
			//~ cout<<plate[i][j]<<endl;
		}
	}
	cin>>x>>y;
	cout<<BFS(0,x-1,y-1)<<endl;
	return 0;
}


#include <bits/stdc++.h>
#define clr(x) memset((x), 0, sizeof(x))
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define mp make_pair
#define For(i, st, en) for(int i=(st); i<=(int)(en); i++)
#define Ford(i, st, en) for(int i=(st); i>=(int)(en); i--)
#define forn(i, n) for(int i=0; i<(int)(n); i++)
#define ford(i, n) for(int i=(n)-1; i>=0; i--)
#define fori(it, x) for (__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define in(x) int (x); input((x));
#define x first
#define y second
#define less(a,b) ((a) < (b) - EPS)
#define more(a,b) ((a) > (b) + EPS)
#define eq(a,b) (fabs((a) - (b)) < EPS)
#define remax(a, b) ((a) = (b) > (a) ? (b) : (a))
#define remin(a, b) ((a) = (b) < (a) ? (b) : (a))
using namespace std;
typedef long double ld; template <class _T> inline _T sqr(const _T& x) {return x * x;} template <class _T> inline string tostr(const _T& a) {ostringstream os(""); os << a; return os.str();} const ld PI = 3.1415926535897932384626433832795L; const double EPS = 1-9; char TEMPORARY_CHAR; typedef long long ll; typedef unsigned long long ull; typedef set < int > SI; typedef vector < int > VI; typedef vector < vector < int > > VVI; typedef map < string, int > MSI; typedef pair < int, int > PII; const int INF = 1e9; inline void input(int &a) {a = 0; while (((TEMPORARY_CHAR = getchar()) > '9' || TEMPORARY_CHAR < '0') && (TEMPORARY_CHAR != '-')){} char neg = 0; if (TEMPORARY_CHAR == '-') {neg = 1; TEMPORARY_CHAR = getchar();} while (TEMPORARY_CHAR <= '9' && TEMPORARY_CHAR >= '0') {a = 10 * a + TEMPORARY_CHAR - '0'; TEMPORARY_CHAR = getchar();} if (neg) a = -a;} inline void out(int a) {if (!a) putchar('0'); if (a < 0) {putchar('-'); a = -a;} char s[10]; int i; for(i = 0; a; ++i) {s[i] = '0' + a % 10; a /= 10;} ford(j, i) putchar(s[j]);} inline int nxt() {in(ret); return ret;}

using namespace std;

int k, n, m;
string s[10][10];

inline bool ch(int a, int b, int c)
{
    return a >= 0 && b >= 0 && c >= 0 && a < k && b < n && c < m;
}

char used[10][10][10];

int dx[] = {1,-1,0,0,0,0};
int dy[] = {0,0,1,-1,0,0};
int dz[] = {0,0,0,0,1,-1};

void dfs(int a, int b, int c)
{
    used[a][b][c] = 1;

    for (int i = 0; i < 6; ++i)
    {
        int tx = a + dx[i];
        int ty = b + dy[i];
        int tz = c + dz[i];

        if (ch(tx, ty, tz))
        {
            if (!used[tx][ty][tz] && s[tx][ty][tz] == '.')
            {
                dfs(tx,ty,tz);
            }
        }
    }
}

int main()
{
    ios_base::sync_with_stdio(false);

    cin >> k >> n >> m;
    for (int i = 0; i < k; ++i)
    {
        for (int j = 0; j < n; ++j)
        {
            cin >> s[i][j];
        }
    }

    int px, py;
    cin >> px >> py;
    --px, --py;

    clr(used);
    dfs(0, px, py);

    int ans = 0;
    for (int i = 0; i < k; ++i)
    {
        for (int j = 0; j < n; ++j)
        {
            for (int k = 0; k < m; ++k)
            {
                ans += used[i][j][k];
            }
        }
    }

    cout << ans << endl;
    return 0;
}


#include<stdio.h>
#include<iostream>
#include<vector>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<algorithm>
#include<deque>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<double,double> pdd;
typedef unsigned long long ull;

#define FOR(i,a,b) for (int i(a); i < (b); i++)
#define REP(i,n) FOR(i,0,n)
#define SORT(v) sort((v).begin(),(v).end())
#define UN(v) sort((v).begin(),(v).end()),v.erase(unique(v.begin(),v.end()),v.end())
#define CL(a,b) memset(a,b,sizeof(a))
#define pb push_back

int main()
{
    int k,n,m,x,y,p[11][11][11],max,answer=0;
    REP(i,11)
    {
        REP(j,11)
        {
            REP(l,11)
            {
                p[i][j][l]=-1;
            }
        }
    }
    cin>>k>>n>>m;
    max=k*n*m;
    REP(i,k)
    {
        REP(j,n)
        {
            string s;
            cin>>s;
            REP(l,m)
            {
                if (s[l]=='.')
                {
                    p[i+1][j+1][l+1]=0;
                }
                else
                {
                    p[i+1][j+1][l+1]=1;
                }
            }
        }
    }
    cin>>x>>y;
    p[1][x][y]=2;
    answer=1;
    FOR(I,2,max+1)
    {
        FOR(i,1,k+1)
        {
            FOR(j,1,n+1)
            {
                FOR(l,1,m+1)
                {
                    if (p[i][j][l]==2)
                    {
                        if (p[i-1][j][l]==0)
                        {
                            p[i-1][j][l]=2;
                            answer=I;
                            goto loop;
                        }
                        if (p[i+1][j][l]==0)
                        {
                            p[i+1][j][l]=2;
                            answer=I;
                            goto loop;
                        }
                        if (p[i][j-1][l]==0)
                        {
                            p[i][j-1][l]=2;
                            answer=I;
                            goto loop;
                        }
                        if (p[i][j+1][l]==0)
                        {
                            p[i][j+1][l]=2;
                            answer=I;
                            goto loop;
                        }
                        if (p[i][j][l-1]==0)
                        {
                            p[i][j][l-1]=2;
                            answer=I;
                            goto loop;
                        }
                        if (p[i][j][l+1]==0)
                        {
                            p[i][j][l+1]=2;
                            answer=I;
                            goto loop;
                        }
                    }
                }
            }
        }
        loop:;
    }
    cout<<answer;
}


#include<stdio.h>
#include<iostream>
#include<vector>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<algorithm>
#include<deque>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<double,double> pdd;
typedef unsigned long long ull;

#define FOR(i,a,b) for (int i(a); i < (b); i++)
#define REP(i,n) FOR(i,0,n)
#define SORT(v) sort((v).begin(),(v).end())
#define UN(v) sort((v).begin(),(v).end()),v.erase(unique(v.begin(),v.end()),v.end())
#define CL(a,b) memset(a,b,sizeof(a))
#define pb push_back

int k,n,m,x,y,p[12][12][12],answer=0;

void dfs(int i,int j,int l)
{
    if (p[i-1][j][l]==0)
    {
        p[i-1][j][l]=2;
        answer++;
        dfs(i-1,j,l);
    }
    if (p[i+1][j][l]==0)
    {
        p[i+1][j][l]=2;
        answer++;
        dfs(i+1,j,l);
    }
    if (p[i][j-1][l]==0)
    {
        p[i][j-1][l]=2;
        answer++;
        dfs(i,j-1,l);
    }
    if (p[i][j+1][l]==0)
    {
        p[i][j+1][l]=2;
        answer++;
        dfs(i,j+1,l);
    }
    if (p[i][j][l-1]==0)
    {
        p[i][j][l-1]=2;
        answer++;
        dfs(i,j,l-1);
    }
    if (p[i][j][l+1]==0)
    {
        p[i][j][l+1]=2;
        answer++;
        dfs(i,j,l+1);
    }
}

int main()
{
    REP(i,12)
    {
        REP(j,12)
        {
            REP(l,12)
            {
                p[i][j][l]=10;
            }
        }
    }
    cin>>k>>n>>m;
    REP(i,k)
    {
        REP(j,n)
        {
            string s;
            cin>>s;
            REP(l,m)
            {
                if (s[l]=='.')
                {
                    p[i+1][j+1][l+1]=0;
                }
                else
                {
                    p[i+1][j+1][l+1]=1;
                }
            }
        }
    }
    cin>>x>>y;
    p[1][x][y]=2;
    answer=1;
    dfs(1,x,y);
    cout<<answer;
}


#include<stdio.h>
#include<iostream>
#include<vector>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<algorithm>
#include<deque>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<double,double> pdd;
typedef unsigned long long ull;

#define FOR(i,a,b) for (int i(a); i < (b); i++)
#define REP(i,n) FOR(i,0,n)
#define SORT(v) sort((v).begin(),(v).end())
#define UN(v) sort((v).begin(),(v).end()),v.erase(unique(v.begin(),v.end()),v.end())
#define CL(a,b) memset(a,b,sizeof(a))
#define pb push_back

int main()
{
    int k,n,m,x,y,p[11][11][11],max,answer=0;
    REP(i,11)
    {
        REP(j,11)
        {
            REP(l,11)
            {
                p[i][j][l]=-1;
            }
        }
    }
    cin>>k>>n>>m;
    max=k*n*m;
    REP(i,k)
    {
        REP(j,n)
        {
            string s;
            cin>>s;
            REP(l,m)
            {
                if (s[l]=='.')
                {
                    p[i+1][j+1][l+1]=0;
                }
                else
                {
                    p[i+1][j+1][l+1]=1;
                }
            }
        }
    }
    cin>>x>>y;
    p[1][x][y]=2;
    answer=1;
    FOR(I,2,max+2)
    {
        FOR(i,1,k+1)
        {
            FOR(j,1,n+1)
            {
                FOR(l,1,m+1)
                {
                    if (p[i][j][l]==2)
                    {
                        if (p[i-1][j][l]==0)
                        {
                            p[i-1][j][l]=2;
                            answer++;
                            goto loop;
                        }
                        if (p[i+1][j][l]==0)
                        {
                            p[i+1][j][l]=2;
                            answer++;
                            goto loop;
                        }
                        if (p[i][j-1][l]==0)
                        {
                            p[i][j-1][l]=2;
                            answer++;
                            goto loop;
                        }
                        if (p[i][j+1][l]==0)
                        {
                            p[i][j+1][l]=2;
                            answer++;
                            goto loop;
                        }
                        if (p[i][j][l-1]==0)
                        {
                            p[i][j][l-1]=2;
                            answer++;
                            goto loop;
                        }
                        if (p[i][j][l+1]==0)
                        {
                            p[i][j][l+1]=2;
                            answer++;
                            goto loop;
                        }
                        cout<<answer;
                        return 0;
                    }
                }
            }
        }
        loop:;
    }
    cout<<answer;
}


#include<stdio.h>
#include<iostream>
#include<vector>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<algorithm>
#include<deque>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<double,double> pdd;
typedef unsigned long long ull;

#define FOR(i,a,b) for (int i(a); i < (b); i++)
#define REP(i,n) FOR(i,0,n)
#define SORT(v) sort((v).begin(),(v).end())
#define UN(v) sort((v).begin(),(v).end()),v.erase(unique(v.begin(),v.end()),v.end())
#define CL(a,b) memset(a,b,sizeof(a))
#define pb push_back

int k,n,m,x,y,p[11][11][11],answer=0;

void dfs(int i,int j,int l)
{
    if (p[i][j][l]==2)
    {
        if (p[i-1][j][l]==0)
        {
            p[i-1][j][l]=2;
            answer++;
            dfs(i-1,j,l);
        }
        if (p[i+1][j][l]==0)
        {
            p[i+1][j][l]=2;
            answer++;
            dfs(i+1,j,l);
        }
        if (p[i][j-1][l]==0)
        {
            p[i][j-1][l]=2;
            answer++;
            dfs(i,j-1,l);
        }
        if (p[i][j+1][l]==0)
        {
            p[i][j+1][l]=2;
            answer++;
            dfs(i,j+1,l);
        }
        if (p[i][j][l-1]==0)
        {
            p[i][j][l-1]=2;
            answer++;
            dfs(i,j,l-1);
        }
        if (p[i][j][l+1]==0)
        {
            p[i][j][l+1]=2;
            answer++;
            dfs(i,j,l+1);
        }
    }
}

int main()
{
    REP(i,11)
    {
        REP(j,11)
        {
            REP(l,11)
            {
                p[i][j][l]=-1;
            }
        }
    }
    cin>>k>>n>>m;
    REP(i,k)
    {
        REP(j,n)
        {
            string s;
            cin>>s;
            REP(l,m)
            {
                if (s[l]=='.')
                {
                    p[i+1][j+1][l+1]=0;
                }
                else
                {
                    p[i+1][j+1][l+1]=1;
                }
            }
        }
    }
    cin>>x>>y;
    p[1][x][y]=2;
    answer=1;
    dfs(1,x,y);
    cout<<answer;
}


#include<stdio.h>
#include<iostream>
#include<vector>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<algorithm>
#include<deque>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<double,double> pdd;
typedef unsigned long long ull;

#define FOR(i,a,b) for (int i(a); i < (b); i++)
#define REP(i,n) FOR(i,0,n)
#define SORT(v) sort((v).begin(),(v).end())
#define UN(v) sort((v).begin(),(v).end()),v.erase(unique(v.begin(),v.end()),v.end())
#define CL(a,b) memset(a,b,sizeof(a))
#define pb push_back

int main()
{
    int k,n,m,x,y,p[11][11][11],max,answer=0;
    REP(i,11)
    {
        REP(j,11)
        {
            REP(l,11)
            {
                p[i][j][l]=-1;
            }
        }
    }
    cin>>k>>n>>m;
    max=k*n*m;
    REP(i,k)
    {
        REP(j,n)
        {
            string s;
            cin>>s;
            REP(l,m)
            {
                if (s[l]=='.')
                {
                    p[i+1][j+1][l+1]=0;
                }
                else
                {
                    p[i+1][j+1][l+1]=1;
                }
            }
        }
    }
    cin>>x>>y;
    p[1][x][y]=2;
    answer=1;
    FOR(I,2,max+2)
    {
        FOR(i,1,k+1)
        {
            FOR(j,1,n+1)
            {
                FOR(l,1,m+1)
                {
                    if (p[i][j][l]==2)
                    {
                        if (p[i-1][j][l]==0)
                        {
                            p[i-1][j][l]=2;
                            answer++;
                            goto loop;
                        }
                        if (p[i+1][j][l]==0)
                        {
                            p[i+1][j][l]=2;
                            answer++;
                            goto loop;
                        }
                        if (p[i][j-1][l]==0)
                        {
                            p[i][j-1][l]=2;
                            answer++;
                            goto loop;
                        }
                        if (p[i][j+1][l]==0)
                        {
                            p[i][j+1][l]=2;
                            answer++;
                            goto loop;
                        }
                        if (p[i][j][l-1]==0)
                        {
                            p[i][j][l-1]=2;
                            answer++;
                            goto loop;
                        }
                        if (p[i][j][l+1]==0)
                        {
                            p[i][j][l+1]=2;
                            answer++;
                            goto loop;
                        }
                    }
                }
            }
        }
        loop:;
    }
    cout<<answer;
}


#include<stdio.h>
#include<iostream>
#include<vector>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<algorithm>
#include<deque>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<double,double> pdd;
typedef unsigned long long ull;

#define FOR(i,a,b) for (int i(a); i < (b); i++)
#define REP(i,n) FOR(i,0,n)
#define SORT(v) sort((v).begin(),(v).end())
#define UN(v) sort((v).begin(),(v).end()),v.erase(unique(v.begin(),v.end()),v.end())
#define CL(a,b) memset(a,b,sizeof(a))
#define pb push_back

int k,n,m,x,y,p[11][11][11],answer=0;

void dfs(int i,int j,int l)
{
    if (p[i-1][j][l]==0)
    {
        p[i-1][j][l]=2;
        answer++;
        dfs(i-1,j,l);
    }
    if (p[i+1][j][l]==0)
    {
        p[i+1][j][l]=2;
        answer++;
        dfs(i+1,j,l);
    }
    if (p[i][j-1][l]==0)
    {
        p[i][j-1][l]=2;
        answer++;
        dfs(i,j-1,l);
    }
    if (p[i][j+1][l]==0)
    {
        p[i][j+1][l]=2;
        answer++;
        dfs(i,j+1,l);
    }
    if (p[i][j][l-1]==0)
    {
        p[i][j][l-1]=2;
        answer++;
        dfs(i,j,l-1);
    }
    if (p[i][j][l+1]==0)
    {
        p[i][j][l+1]=2;
        answer++;
        dfs(i,j,l+1);
    }
}

int main()
{
    REP(i,11)
    {
        REP(j,11)
        {
            REP(l,11)
            {
                p[i][j][l]=10;
            }
        }
    }
    cin>>k>>n>>m;
    REP(i,k)
    {
        REP(j,n)
        {
            string s;
            cin>>s;
            REP(l,m)
            {
                if (s[l]=='.')
                {
                    p[i+1][j+1][l+1]=0;
                }
                else
                {
                    p[i+1][j+1][l+1]=1;
                }
            }
        }
    }
    cin>>x>>y;
    p[1][x][y]=2;
    answer=1;
    dfs(1,x,y);
    cout<<answer;
}


#include<stdio.h>
#include<iostream>
#include<vector>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<algorithm>
#include<deque>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<double,double> pdd;
typedef unsigned long long ull;

#define FOR(i,a,b) for (int i(a); i < (b); i++)
#define REP(i,n) FOR(i,0,n)
#define SORT(v) sort((v).begin(),(v).end())
#define UN(v) sort((v).begin(),(v).end()),v.erase(unique(v.begin(),v.end()),v.end())
#define CL(a,b) memset(a,b,sizeof(a))
#define pb push_back

int main()
{
    int k,n,m,x,y,p[11][11][11],max,answer=0;
    REP(i,11)
    {
        REP(j,11)
        {
            REP(l,11)
            {
                p[i][j][l]=-1;
            }
        }
    }
    cin>>k>>n>>m;
    max=k*n*m;
    REP(i,k)
    {
        REP(j,n)
        {
            string s;
            cin>>s;
            REP(l,m)
            {
                if (s[l]=='.')
                {
                    p[i+1][j+1][l+1]=0;
                }
                else
                {
                    p[i+1][j+1][l+1]=1;
                }
            }
        }
    }
    cin>>x>>y;
    p[1][x][y]=2;
    answer=1;
    FOR(I,2,max+2)
    {
        FOR(i,1,k+1)
        {
            FOR(j,1,n+1)
            {
                FOR(l,1,m+1)
                {
                    if (p[i][j][l]==2)
                    {
                        if (p[i-1][j][l]==0)
                        {
                            p[i-1][j][l]=2;
                            answer=I;
                            goto loop;
                        }
                        if (p[i+1][j][l]==0)
                        {
                            p[i+1][j][l]=2;
                            answer=I;
                            goto loop;
                        }
                        if (p[i][j-1][l]==0)
                        {
                            p[i][j-1][l]=2;
                            answer=I;
                            goto loop;
                        }
                        if (p[i][j+1][l]==0)
                        {
                            p[i][j+1][l]=2;
                            answer=I;
                            goto loop;
                        }
                        if (p[i][j][l-1]==0)
                        {
                            p[i][j][l-1]=2;
                            answer=I;
                            goto loop;
                        }
                        if (p[i][j][l+1]==0)
                        {
                            p[i][j][l+1]=2;
                            answer=I;
                            goto loop;
                        }
                    }
                }
            }
        }
        loop:;
    }
    cout<<answer;
}


#include<stdio.h>
#include<iostream>
#include<vector>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<algorithm>
#include<deque>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<double,double> pdd;
typedef unsigned long long ull;

#define FOR(i,a,b) for (int i(a); i < (b); i++)
#define REP(i,n) FOR(i,0,n)
#define SORT(v) sort((v).begin(),(v).end())
#define UN(v) sort((v).begin(),(v).end()),v.erase(unique(v.begin(),v.end()),v.end())
#define CL(a,b) memset(a,b,sizeof(a))
#define pb push_back

int main()
{
    int k,n,m,x,y,p[11][11][11],max,answer=0;
    REP(i,11)
    {
        REP(j,11)
        {
            REP(l,11)
            {
                p[i][j][l]=-1;
            }
        }
    }
    cin>>k>>n>>m;
    max=k*n*m;
    REP(i,k)
    {
        REP(j,n)
        {
            string s;
            cin>>s;
            REP(l,m)
            {
                if (s[l]=='.')
                {
                    p[i+1][j+1][l+1]=0;
                }
                else
                {
                    p[i+1][j+1][l+1]=1;
                }
            }
        }
    }
    cin>>x>>y;
    p[1][x][y]=2;
    answer=1;
    FOR(I,2,max+2)
    {
        FOR(i,1,k+1)
        {
            FOR(j,1,n+1)
            {
                FOR(l,1,m+1)
                {
                    if (p[i][j][l]==2)
                    {
                        if (p[i-1][j][l]==0)
                        {
                            p[i-1][j][l]=2;
                            answer++;
                            goto loop;
                        }
                        if (p[i+1][j][l]==0)
                        {
                            p[i+1][j][l]=2;
                            answer++;
                            goto loop;
                        }
                        if (p[i][j-1][l]==0)
                        {
                            p[i][j-1][l]=2;
                            answer++;
                            goto loop;
                        }
                        if (p[i][j+1][l]==0)
                        {
                            p[i][j+1][l]=2;
                            answer++;
                            goto loop;
                        }
                        if (p[i][j][l-1]==0)
                        {
                            p[i][j][l-1]=2;
                            answer++;
                            goto loop;
                        }
                        if (p[i][j][l+1]==0)
                        {
                            p[i][j][l+1]=2;
                            answer++;
                            goto loop;
                        }
                    }
                }
            }
        }
        cout<<answer;
        return 0;
        loop:;
    }
    cout<<answer;
}


#include<stdio.h>
#include<iostream>
#include<vector>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<algorithm>
#include<deque>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<double,double> pdd;
typedef unsigned long long ull;

#define FOR(i,a,b) for (int i(a); i < (b); i++)
#define REP(i,n) FOR(i,0,n)
#define SORT(v) sort((v).begin(),(v).end())
#define UN(v) sort((v).begin(),(v).end()),v.erase(unique(v.begin(),v.end()),v.end())
#define CL(a,b) memset(a,b,sizeof(a))
#define pb push_back

int main()
{
    int k,n,m,x,y,p[11][11][11],max,answer=0;
    REP(i,11)
    {
        REP(j,11)
        {
            REP(l,11)
            {
                p[i][j][l]=-1;
            }
        }
    }
    cin>>k>>n>>m;
    max=k*n*m;
    REP(i,k)
    {
        REP(j,n)
        {
            string s;
            cin>>s;
            REP(l,m)
            {
                if (s[l]=='.')
                {
                    p[i+1][j+1][l+1]=0;
                }
                else
                {
                    p[i+1][j+1][l+1]=1;
                }
            }
        }
    }
    cin>>x>>y;
    p[1][x][y]=2;
    answer=1;
    FOR(I,2,max+2)
    {
        FOR(i,1,k+1)
        {
            FOR(j,1,n+1)
            {
                FOR(l,1,m+1)
                {
                    if (p[i][j][l]==2)
                    {
                        if (p[i-1][j][l]==0)
                        {
                            p[i-1][j][l]=2;
                            answer++;
                            goto loop;
                        }
                        if (p[i+1][j][l]==0)
                        {
                            p[i+1][j][l]=2;
                            answer++;
                            goto loop;
                        }
                        if (p[i][j-1][l]==0)
                        {
                            p[i][j-1][l]=2;
                            answer++;
                            goto loop;
                        }
                        if (p[i][j+1][l]==0)
                        {
                            p[i][j+1][l]=2;
                            answer++;
                            goto loop;
                        }
                        if (p[i][j][l-1]==0)
                        {
                            p[i][j][l-1]=2;
                            answer++;
                            goto loop;
                        }
                        if (p[i][j][l+1]==0)
                        {
                            p[i][j][l+1]=2;
                            answer++;
                            goto loop;
                        }
                        cout<<answer'
                        return 0;
                    }
                }
            }
        }
        loop:;
    }
    cout<<answer;
}


#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <cmath>
#include <climits>
#include <string>
#include <cctype>
#include <ctime>
#include <sstream>
#include <algorithm>
#include <list>
#include <map>
#include <set>
#include <stack>
#include <queue>
using namespace std;

// <editor-fold defaultstate="collapsed" desc="Defines">

typedef long long ll;
typedef unsigned long long ull;
typedef pair<double, double> dd;
typedef pair<int, int> ii;
typedef pair<string, int> si;
typedef map<int, int> mi;
typedef map<string, int> msi;
typedef set<int> sei;
typedef vector<si> vsi;
typedef vector<dd> vdd;
typedef vector<double> vd;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<ull> vull;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<string> vs;
const double PI = 3.14159265358979;
const double PI2 = 6.28318530717958;
const double PId2 = 1.570796326794895;
#define MP make_pair
#define X first
#define Y second
#define eps 1E-9
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()

template<typename T> T sqr(T x)
{
    return x*x;
}

template<typename T> T gcd(T a, T b)
{
    return (b ? gcd(b, a % b) : a);
}

ll pw(ll a, ll p, int mod)
{
    ll res = 1;
    while (p) {
        if (p & 1) {
            --p;
            res = (res * a) % mod;
        } else {
            p >>= 1;
            a = (a * a) % mod;
        }
    }
    return res;
}

inline vi ReadVI(int count)
{
    vi arrayname(count);
    for (int i = 0; i < count; i++) cin >> arrayname[i];
    return arrayname;
}

inline vll ReadVlong(int count)
{
    vll arrayname(count);
    for (int i = 0; i < count; i++) cin >> arrayname[i];
    return arrayname;
}

const int MOD = 1000000007;
const int MAXVALUE = 2001;

// </editor-fold >

typedef vector<vvi> vvvi;

vvvi g;
vvvi used;

int k, n, m;

void dfs(int z, int x, int y)
{
    used[z][x][y] = 1;
    // layer up
    if (z > 0 && g[z - 1][x][y] == 1 && used[z - 1][x][y] == 0)
        dfs(z - 1, x, y);
    // layer down
    if (z + 1 < k && g[z + 1][x][y] == 1 && used[z + 1][x][y] == 0)
        dfs(z + 1, x, y);
    // up
    if (x - 1 >= 0 && g[z][x - 1][y] == 1 && used[z][x - 1][y] == 0)
        dfs(z, x - 1, y);
    // down
    if (x + 1 < n && g[z][x + 1][y] == 1 && used[z][x + 1][y] == 0)
        dfs(z, x + 1, y);
    // left
    if (y - 1 >= 0 && g[z][x][y - 1] == 1 && used[z][x][y - 1] == 0)
        dfs(z, x, y - 1);
    // right
    if (y + 1 < m && g[z][x][y + 1] == 1 && used[z][x][y + 1] == 0)
        dfs(z, x, y + 1);
}

int main()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
#else
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
#endif
    int x, y;
    char c;
    cin >> k >> n >> m;
    g = vvvi(k, vvi(n, vi(m, 0)));
    used = vvvi(k, vvi(n, vi(m, 0)));
    for (int z = 0; z < k; z++) for (int i = 0; i < n; i++)
            for (int j = 0; j < m; j++) {
                cin >> c;
                if (c == '.') g[z][i][j] = 1;
            }
    cin >> x >> y;
    x--, y--;
    dfs(0, x, y);
    int ans = 0;
    for (int z = 0; z < k; z++) for (int i = 0; i < n; i++) for (int j = 0; j < m; j++) ans += (used[z][i][j] == 1);
    cout << ans;
    return 0;
}


#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <queue>
#include <stack>
#include <algorithm>
#include <iostream>
#include <string>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <climits>
#include <cctype>
#include <iomanip>
#include <bitset>
#include <list>
#include <deque>
#include <utility>
#include <functional>
#include <cassert>

using namespace std;

#define all(a)              (a).begin(), (a).end()
#define ms(a,b)             memset(a, b, sizeof(a))
#define mp                  make_pair
#define pb                  push_back
#define fore(it,a)          for (auto it = (a).begin(), it##_ = (a).end(); it != it##_; it++)
#define f0r(i, a)           for (int i = 0, i##_ = (a); i < i##_; i++)
#define debug(args...)      do {cerr << #args << ": "; dbg,args; cerr << endl;} while(0)
#define read(type, args...) type args; rdr,args;
#define fi                  first
#define se                  second
#define bit_no              __builtin_popcount
#define left(a)             (2*(a))
#define right(a)            (2*(a)+1)
#define mid(left, right)    (((left)+(right))/2+1)

typedef long long               ll;
typedef long double             ld;
typedef unsigned long long      ull;
typedef vector<int>             vi;
typedef vector<vi>              vvi;
typedef pair<int, int>          ii;
typedef tuple<int, int, int>    iii;
typedef vector<ii>              vii;
typedef vector<iii>             viii;

template<typename T>
using min_pq = priority_queue<T, vector<T>, greater<T>>;

const int inf = 2e8+5;
const ll l_inf = 9e18+5;
const int mod_v = 1e9+7;
const int max_n = 7+5;

template<typename T>
T gcd(T a, T b)
{
    while (b) {
        T temp = a % b;
        a = b;
        b = temp;
    }
    return a;
}

template<typename T>
tuple<T, T, T> egcd(T a, T b)
{
    T x1 = 1, x2 = 0, y1 = 0, y2 = 1;
    while (b) {
        T q = a / b, r = a % b;
        T new_x = x1 - q*x2, new_y = y1 - q*y2;
        x1 = x2, y1 = y2, x2 = new_x, y2 = new_y;
        a = b, b = r;
    }
    return make_tuple(a, x1, y1);
}

inline ll lcm(ll a, ll b)
{
    return a*b/gcd(a, b);
}

template<typename T>
inline T mod(T a, T b = mod_v)
{
    return (a % b + b) % b;
}

template<typename T>
inline T mod_inv(T a, T b = mod_v)
{
    return mod(get<1>(egcd(a, b)), b);
}

template<typename T>
inline T sum(T a, T b, T m = mod_v)
{
    return mod(mod(a, m) + mod(b, m), m);
}

template<typename T>
inline T difference(T a, T b, T m = mod_v)
{
    return mod(mod(a, m) - mod(b, m), m);
}

inline ll product(ll a, ll b, ll m = mod_v)
{
    return mod(mod(a, m) *  mod(b, m), m);
}

inline ll quotient(ll a, ll b, ll m = mod_v)
{
    return mod(mod(a, m) * mod_inv(b, m), m);
}

template<typename T,typename T2>
ostream& operator<< (ostream &s, const pair<T,T2> &p) {return s << p.fi << ' ' << p.se << ' ';}

template<typename T,typename T2>
istream& operator>> (istream &s, pair<T,T2> &p) {return s >> p.fi >> p.se;}

template<typename T>
ostream& operator<< (ostream &s, const vector<T> &v)  {for (auto it: v) s << it << ' '; return s;}

template<typename T>
istream& operator>> (istream &s, vector<T> &v) {fore (it, v) s >> *it; return s;}

template<typename T>
void read_range(T beg, T end)
{
    while (beg != end)
        cin >> *beg++;
}

template<typename T>
void print_range(T beg, T end)
{
    while (beg != end)
        cout << *beg++ << ' ';
}

struct reader
{
    template<typename T>
    reader& operator, (T &v)
    {
        cin >> v;
        return *this;
    }
} rdr;

struct debugger
{
    template<typename T>
    debugger& operator, (const T &v)
    {
        cerr << v << ", ";
        return *this;
    }
} dbg;

/***************************************************************
----------------------------------------------------------------
----------------------------------------------------------------
***************************************************************/

string ar[max_n][max_n];
bool visited[max_n][max_n][max_n];
int visit_cnt;
int k, n, m;

void dfs(int z, int x, int y)
{
    visited[z][x][y] = true;
    visit_cnt++;

    if (x > 1 and ar[z][x-1][y-1] == '.' and !visited[z][x-1][y])
        dfs(z, x-1, y);
    if (x < n and ar[z][x+1][y-1] == '.' and !visited[z][x+1][y])
        dfs(z, x+1, y);
    if (y > 1 and ar[z][x][y-2] == '.' and !visited[z][x][y-1])
        dfs(z, x, y-1);
    if (y < m and ar[z][x][y] == '.' and !visited[z][x][y+1])
        dfs(z, x, y+1);
    if (z > 1 and ar[z-1][x][y-1] == '.' and !visited[z-1][x][y])
        dfs(z-1, x, y);
    if (z < k and ar[z+1][x][y-1] == '.' and !visited[z+1][x][y])
        dfs(z+1, x, y);
}

int main()
{
    ios_base::sync_with_stdio(false);

    cin >> k >> n >> m;
    for (int i = 1; i <= k; i++)
        for (int j = 1; j <= n; j++)
            cin >> ar[i][j];

    read(int, x, y);
    dfs(1, x, y);

    cout << visit_cnt;

    return 0;
}


#include <iostream>
#include <vector>
#include <queue>
using namespace std;

struct point
{
	size_t u, i, j;
	point()
	{}
	point(size_t _u, size_t _i, size_t _j): u(_u), i(_i), j(_j)
	{}
};

int main(void)
{
	int k, n, m;
	cin >> k >> n >> m;
	vector<vector<vector<char>>> v(k);
	for (int u = 0; u < k; ++u)
	{
		v[u].resize(n);
		cin.get();
		for (int i = 0; i < n; ++i)
		{
			v[u][i].resize(m);
			for (int j = 0; j < m; ++j)
			{
				cin >> v[u][i][j];
			}
		}
	}
	int x, y;
	cin >> x >> y;
	queue<point> q;
	q.push(point(0, --x, --y));
	point h[] =
	{
		point(0, 1, 0), point(0, 0, 1), point(0, -1, 0), point(0, 0, -1),
		point(1, 0, 0), point(-1, 0, 0)
	};
	int nh = sizeof h / sizeof *h;
	int ans = 0;
	v[0][x][y] = 's';
	while (!q.empty())
	{
		point w = q.front();
		q.pop();
		++ans;
		for (int t = 0; t < nh; ++t)
		{
			size_t i = w.i+h[t].i, j = w.j+h[t].j, u = w.u+h[t].u;
			if (i < n && j < m && u < k && v[u][i][j] == '.')
			{
				q.push(point(u, i, j));
				v[u][i][j] = '$';
			}
		}
	}
	cout << ans;
	return 0;
}


#include <iostream>
#include <stack>
#include <cstdlib>
using namespace std;

struct dim3
{
	int x, y, z;
	dim3() {}
	dim3(int _x, int _y, int _z): x(_x), y(_y), z(_z) {}
};

int dist(const dim3 &A, const dim3 &B)
{
	return abs(A.x-B.x)+abs(A.y-B.y)+abs(A.z-B.z);
}

int main()
{
	int k, n, m;
	cin >> k >> n >> m;
	cin.ignore(5, '\n');

	char c;
	char ***a=new char **[k];
	for(int i1=0; i1<k; i1++)
	{
		a[i1]=new char *[n];
		for(int i2=0; i2<n; i2++)
		{
			a[i1][i2]=new char[m];
			for(int i3=0; i3<m; i3++)
			{
				cin >> c;
				a[i1][i2][i3]=c;
			}
			cin.ignore(5, '\n');
		}
		cin.ignore(5, '\n');
	}

	int x, y;
	cin >> x >> y;
	x--;
	y--;
	int result=0;
	stack <dim3> all_points;
	dim3 seed(x,y,0);

	if(a[0][x][y]=='.') all_points.push(seed);
	a[0][x][y]=',';
	while(!all_points.empty())
	{
		seed=all_points.top();
		all_points.pop();
		result++;
		for(int x=seed.x-1; x<=seed.x+1; x++)
			for(int y=seed.y-1; y<=seed.y+1; y++)
				for(int z=seed.z-1; z<=seed.z+1; z++)
				{
					dim3 nova(x,y,z);
					if(dist(nova,seed)==1 && 0<=x && x<n && 0<=y && y<m && 0<=z && z<k)
					{
						if(a[z][x][y]=='.')
						{
							a[z][x][y]=',';
							all_points.push(nova);
						}
					}
				}
	}

	cout << result;
	for(int i1=0; i1<k; i1++)
	{
		for(int i2=0; i2<n; i2++)
		{
			delete[] a[i1][i2];
		}
		delete[] a[i1];
	}
	delete[] a;
	return 0;
}


#include <stdio.h>
#include <string.h>
#include<iostream>

using namespace std;
int K,M, N, cnt, sx, sy, ex, ey;
char grid[21][21][21];
int vis[21][21][21];
int dx[]= {0,0,0,0,1,-1};
int dy[]= {0,0,1,-1,0,0};
int dz[]= {1,-1,0,0,0,0};

int dfs(int x, int y,int z) {
    if (vis[x][y][z])
        return 0;
    vis[x][y][z] = 1;
    int i;
    for (i=0; i<6; i++) {
        int nx = x+dx[i], ny = y+dy[i],nz=z+dz[i];
        if (nx>=0&&ny>=0&&nz>=0&&nx<K&&ny<N&&nz<M&&grid[nx][ny][nz]!='#'&&!vis[nx][ny][nz])
            if (dfs(nx,ny,nz))
                return 1;
    }
    return 0;
}

int main() {

        scanf("%d %d %d",&K, &N, &M);
        int i,j,k;
        for (i=0; i<K; i++)
            for (j=0;j<N;++j)

            scanf("%s", grid[i][j]);
           /* for (i=0; i<K; i++)
            for (j=0;j<N;++j){
                for(k=0;k<M;k++)
                cout <<grid[i][j][k];
                cout <<endl;
            }*/

        for(i=0;i<K;i++)for(j=0;j<N;j++)for(k=0;k<M;k++)vis[i][j][k]=0;
        cnt = 0;
        int x,y;
        cin >>x>>y;
        x--;
        y--;
        int chay = dfs(0,x,y);
        for(i=0;i<K;i++)for(j=0;j<N;j++)for(k=0;k<M;k++){
            if (vis[i][j][k]==1) cnt++;
        }
        if (cnt==0)cnt++;
        printf("%d",cnt);
    return 0;
}


#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <cmath>
#include <queue>
#include <bitset>
#pragma comment (linker, "/STACK:256000000")

using namespace std;

const int maxN = 15;
int k, n, m;

char s[maxN][maxN][maxN];
bool used[maxN][maxN][maxN];

bool isValid(int x, int y, int z) {
	return 0 <= x && x < k && 0 <= y && y < n && 0 <= z && z < m && s[x][y][z] == '.';
}

int res = 0;

void dfs(int x, int y, int z) {
	if (used[x][y][z]) {
		return;
	}
	++res;
	used[x][y][z] = true;
	if (isValid(x - 1, y, z)) dfs(x - 1, y, z);
	if (isValid(x + 1, y, z)) dfs(x + 1, y, z);
	if (isValid(x, y - 1, z)) dfs(x, y - 1, z);
	if (isValid(x, y + 1, z)) dfs(x, y + 1, z);
	if (isValid(x, y, z - 1)) dfs(x, y, z - 1);
	if (isValid(x, y, z + 1)) dfs(x, y, z + 1);
}

int main() {
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	scanf("%d%d%d", &k, &n, &m);
	for (int i = 0; i < k; ++i) {
		for (int j = 0; j < n; ++j) {
			scanf("%s", &s[i][j]);
		}
	}
	int x, y;
	scanf("%d%d", &x, &y);
	dfs(0, x - 1, y - 1);
	cout << res << endl;

	return 0;
}


#include <iostream>
#define optimizar_io ios_base::sync_with_stdio(0);cin.tie(0);
using namespace std;

int n, m, k;
int cont;
char mapa[12][12][12];
bool vis[12][12][12];
int x, y;
int mov[6][3] = { {1, 0, 0}, {-1, 0, 0},
                  {0, 1, 0}, {0, -1, 0},
                  {0, 0, 1}, {0, 0, -1} };

void dfs( int x, int y, int z ){
    if( x < 1 || y < 1 || z < 1 || x > k || y > n || z > m )
        return;
    if( mapa[x][y][z] == '#' )
        return;
    if( vis[x][y][z] )
        return;

    vis[x][y][z] = 1;
    cont++;
    for( int i = 0; i < 6; i++ )
        dfs( x + mov[i][0], y + mov[i][1], z + mov[i][2] );

}

int main()
{

    optimizar_io
    cin >> k >> n >> m;
    for( int i = 1; i <= k; i++ )
        for( int j = 1; j <= n; j++ )
            for( int l = 1; l <= m; l++ )
                cin >> mapa[i][j][l];
    cin >> x >> y;
    dfs( 1, x, y );
    cout << cont << "\n";

    return 0;

}


#include <iostream>
#include <vector>
#include <algorithm>
#include <fstream>
#include <string>

namespace{
	using std::cin;
	using std::cout;
	using std::vector;

}

int M[12][12][12];
int res=0;

void dfs_visit(int x,int y, int k)
{
	M[k][x][y]=2;
	res++;
	if(M[k][x][y-1] == 1)
		dfs_visit(x,y-1,k);
	if(M[k][x][y+1] == 1)
		dfs_visit(x,y+1,k);
	if(M[k][x-1][y] == 1)
		dfs_visit(x-1,y,k);
	if(M[k][x+1][y] == 1)
		dfs_visit(x+1,y,k);
	if(M[k-1][x][y] == 1)
		dfs_visit(x,y,k-1);
	if(M[k+1][x][y] == 1)
		dfs_visit(x,y,k+1);

}

int main()
{
#ifdef _TEST
	std::ifstream in("INPUT.txt");
	std::ofstream out("OUTPUT.txt");

	cin.rdbuf(in.rdbuf());
	cout.rdbuf(out.rdbuf());
#endif

	 int m,n,k;
	 char ch;

	 cin>>k>>n>>m;

	 for(int u=1; u< k+1;++u){

		 for(int i=1;i< n+1;++i){
			 for(int j=1; j< m+1;++j){

				 cin>>ch;
				 if(ch == '.')
					 M[u][i][j]=1;

			 }
			 cin.get();
		 }
		 cin.get();
	 }

	 int x,y;
	 cin>>x>>y;

	 dfs_visit(x,y,1);

	 cout<<res;

	//std::system("PAUSE");
	return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <fstream>
#include <string>

namespace{
	using std::cin;
	using std::cout;
	using std::vector;

}

int M[12][12][12];
int res=0;

void dfs_visit(int x,int y, int k)
{
	M[k][x][y]=2;
	res++;
	if(M[k][x][y-1] == 1)
		dfs_visit(x,y-1,k);
	if(M[k][x][y+1] == 1)
		dfs_visit(x,y+1,k);
	if(M[k][x-1][y] == 1)
		dfs_visit(x-1,y,k);
	if(M[k][x+1][y] == 1)
		dfs_visit(x+1,y,k);
	if(M[k-1][x][y] == 1)
		dfs_visit(x,y,k-1);
	if(M[k+1][x][y] == 1)
		dfs_visit(x,y,k+1);

}

int main()
{
#ifdef _TEST
	std::ifstream in("INPUT.txt");
	std::ofstream out("OUTPUT.txt");

	cin.rdbuf(in.rdbuf());
	cout.rdbuf(out.rdbuf());
#endif

	 int m,n,k;
	 char ch;

	 cin>>k>>n>>m;

	 for(int u=1; u< k+1;++u){

		 for(int i=1;i< n+1;++i){
			 for(int j=1; j< m+1;++j){

				 cin>>ch;
				 if(ch == '.')
					 M[u][i][j]=1;

			 }
			 cin.get();
		 }
		 cin.get();
	 }

	 int x,y;
	 cin>>x>>y;

	 dfs_visit(x,y,1);

	 cout<<res;

	std::system("PAUSE");
	return 0;
}


#include <cstdio>
#include <cctype>
#include <cstring>
#include <utility>
#include <algorithm>
using namespace std;

int s,n,m;
char a[12][12][12];

int floodfill(int h, int r, int c){
    if(a[h][r][c]=='#') return 0;
    int ret=1;
    a[h][r][c]='#';
    ret+=floodfill(h-1,r,c);
    ret+=floodfill(h+1,r,c);
    ret+=floodfill(h,r-1,c);
    ret+=floodfill(h,r+1,c);
    ret+=floodfill(h,r,c-1);
    ret+=floodfill(h,r,c+1);
    return ret;
}

int main(){
    scanf("%d%d%d",&s,&n,&m);
    memset(a,'#',sizeof(a));
    for(int i=1;i<=s;i++) for(int j=1;j<=n;j++) for(int k=1;k<=m;k++)
        while(isspace(a[i][j][k]=getchar()));
    int r,c;
    scanf("%d%d",&r,&c);
    printf("%d\n",floodfill(1,r,c));
}


#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <sstream>
#include <utility>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cassert>
#include <bitset>
#include <list>
#include <memory.h>

using namespace std;

int g[12][12][12];
int tmp[12][12][12];
int k, n, m;
int s, e;

struct p {
  int x, y, z;
  p(int xx, int yy, int zz) {
    x = xx;
    y = yy;
    z = zz;
  }
};

inline bool range(int x, int y, int z) {
  return (1 <= x && x <= n && 1 <= y && y <= m && 1 <= z && z <= k);
}

const int dx[] = {-1, 0, 0, 1};
const int dy[] = {0, -1, 1, 0};

void bfs(int x, int y, int z) {
  queue< p > q;
  q.push(p(x, y, z));
  while(!q.empty()) {
    x = q.front().x;
    y = q.front().y;
    z = q.front().z;
    g[x][y][z] = 2;
    q.pop();
    for(int id = 0; id < 4; id++) {
      int u = dx[id] + x;
      int v = dy[id] + y;
      int w = z;
      if(!range(u, v, w) || g[u][v][w] == 2) continue;
      q.push(p(u, v, w));
      g[u][v][w] = 2;
    }
    if (range(x, y, z - 1) && g[x][y][z - 1] == 1) {
      q.push(p(x, y, z - 1));
      g[x][y][z] = 2;
    }
    if (range(x, y, z + 1) && g[x][y][z + 1] == 1) {
      q.push(p(x, y, z + 1));
      g[x][y][z] = 2;
    }
  }
}

int main() {
  ios_base::sync_with_stdio(false);
  cin >> k >> n >> m;
  for(int i = 1; i <= k; i++) {
    for(int j = 1; j <= n; j++) {
      for(int l = 1; l <= m; l++) {
        char ch;
        cin >> ch;
        if(ch == '.') g[j][l][i] = 1;
        else if (ch == '#') g[j][l][i] = 2;
        else assert(false);
      }
    }
  }
  for(int i = 1; i <= n; i++) {
    for(int j = 1; j <= m; j++) {
      for(int l = 1; l <= k; l++) {
        tmp[i][j][l] = g[i][j][l];
      }
    }
  }
  cin >> s >> e;
  bfs(s, e, 1);
  int dif = 0;
  for(int i = 1; i <= n; i++)
    for(int j = 1; j <= m; j++)
      for(int l = 1; l <= k; l++) {
        if(tmp[i][j][l] == 1 && g[i][j][l] == 2) dif++;
      }
  cout << dif << endl;
    return 0;
}


#include <bits/stdc++.h>

using namespace std;
char T[11][11][11];
bool visited[11][11][11];
int k,n,m,sum=0;
void dfs(int x , int y ,int z){
if(x<=0 || x>k || y<=0 || y>n || z<=0 || z>m || visited[x][y][z] || T[x][y][z]!='.')
    return;
    sum++;
    visited[x][y][z]=true;
dfs(x-1,y,z); dfs(x+1,y,z); dfs(x,y-1,z); dfs(x,y+1,z); dfs(x,y,z-1); dfs(x,y,z+1);
}
int main()
{int x,y,i,j,l;
char c;
scanf("%d %d %d",&k,&n,&m);
scanf("\n");
 scanf("%d%d%d",&k,&n,&m);
    for(i=1;i<=k;i++)
    {
        for(j=1;j<=n;j++)
        {
            for(l=1;l<=m;l++)
            {
                scanf("%c",&c);
                while(c=='\n')
                {
                    scanf("%c",&c);
                }
                T[i][j][l]=c;
            }
        }
    }
 for(int i=1;i<=k;i++)
 {
     for(int j=1;j<=n;j++)
     for(int p=1;p<=m;p++)
     visited[i][j][p]=false;
      }
 scanf("%d %d",&x,&y);
    dfs(1,x,y);
    cout << sum << endl;
    return 0;
}


#include <iostream>
#include <fstream>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <string>
#include <sstream>

using namespace std;

const int INF = 1e9;
const int MOD = 1e9 + 7;

int ans = 0;
vector<vector<vector<bool> > > used;
vector<vector<vector<char> > > field;
int k, n, m;

int dx[6] = {1, -1, 0, 0, 0, 0};
int dy[6] = {0, 0, 1, -1, 0, 0};
int dz[6] = {0, 0, 0, 0, 1, -1};

bool isInTheField(int x, int y, int z)
{
    return x >= 0 && y >= 0 && z >= 0 && x < k && y < n && z < m;
}

void dfs(int x, int y, int z)
{
    used[x][y][z] = true;
    ans++;
    for (int i = 0; i < 6; ++i)
    {
        if (isInTheField(x + dx[i], y + dy[i], z + dz[i]) && !used[x + dx[i]][y + dy[i]][z + dz[i]] && field[x + dx[i]][y + dy[i]][z + dz[i]] == '.')
        {
            dfs(x + dx[i], y + dy[i], z + dz[i]);
        }
    }
}

int main()
{
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
	ios::sync_with_stdio (0);
    cin >> k >> n >> m;
    used.resize(k);
    field.resize(k);
    for (int i = 0; i < k; ++i)
    {
        used[i].resize(n);
        field[i].resize(n);
        for (int j = 0; j < n; ++j)
        {
            used[i][j].resize(m, 0);
            field[i][j].resize(m);
        }
    }
    for (int i = 0; i < k; ++i)
    {
        for (int j = 0; j < n; ++j)
        {
            for (int p = 0; p < m; ++p)
            {
                cin >> field[i][j][p];
            }
        }
    }
    int x, y;
    cin >> x >> y;
    dfs(0, x - 1, y - 1);
    cout << ans << endl;
	return 0;
}


#include <iostream>
#include <cstdio>
#include <math.h>
#include <vector>
#include <map>
#include <stdio.h>
#include <string>
#include <algorithm>
using namespace std;
long long INF=1000*1000*1000;
long long p=31;
char g[11][11][11];
bool use[11][11][11];

int c=0;
int k,n,m;
void dfs(int x, int y, int z)
{
    if(z<0 || z>=k)
        return;
    if(y<0 || y>=n)
        return;
    if(x<0 || x>=m)
        return;
    if(use[z][y][x] || g[z][y][x]=='#')
        return;

    c++;
    use[z][y][x]=true;
    dfs(x-1,y,z);
    dfs(x+1,y,z);
    dfs(x,y-1,z);
    dfs(x,y+1,z);
    dfs(x,y,z-1);
    dfs(x,y,z+1);
}

int main()
{

    cin>>k>>n>>m;
    for(int i=0;i<k;++i)
        for(int j=0;j<n;++j)
            for(int l=0;l<m;++l)
            {
               cin>>g[i][j][l];
               use[i][j][l]=false;
            }
    int x,y;
    cin>>x>>y;
    dfs(y-1,x-1,0);
    cout<<c;

    return 0;
}


#include <iostream>
#include <sstream>
#include <cstdio>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <utility>
#include <cassert>
#include <numeric>
#include <sstream>
using namespace std;

#define REQUIRE(cond, message) \
    do { \
        if (!(cond)) { \
            std::cerr << message << std::endl; \
            assert(false); \
        } \
    } while (false)

#define forn(i, n) for (int i = 0; i < int(n); ++i)
#define for1(i, n) for (int i = 1; i <= int(n); ++i)
#define forv(i, v) forn(i, (v).size())
#define pb push_back
#define mp make_pair
#define all(v) (v).begin(), (v).end()

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long long ll;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef vector<string> vs;
typedef long double ld;
const vi dx = {1, -1, 0, 0, 0, 0};
const vi dy = {0, 0, 1, -1, 0, 0};
const vi dz = {0, 0, 0, 0, 1, -1};
int k, n, m;
bool isInside(int x, int y, int z)
{
    return x >= 0 && y >= 0 && z >= 0 &&
           z < k && x < n && y < m;
}
typedef vector<bool> vb;
vector<vs> plate;
vector<vector<vb> > used;
int dfs(int x, int y, int z)
{
    used[x][y][z] = true;
    int cnt = 1;
    forv(i, dx) {
        int xx = x + dx[i];
        int yy = y + dy[i];
        int zz = z + dz[i];
        if (isInside(xx, yy, zz) && !used[xx][yy][zz] &&
            plate[xx][yy][zz] == '.') {
            cnt += dfs(xx, yy, zz);
        }
    }
    return cnt;
}

void solve()
{
    cin >> k >> n >> m;
    plate.resize(n);
    used.resize(n);
    forn(i, n) used[i].resize(m, vb(k));
    forn(i, n) plate[i].resize(m, string(k, '#'));
    forn(i, k) {
        string s;
        forn(j, n) {
            cin >> s;
            forv(l, s) {
                plate[j][l][i] = s[l];
            }
        }
    }
    int x, y; cin >> x >> y;
    --x, --y;
    cout << dfs(x, y, 0) << endl;
}

int main()
{
    ios_base::sync_with_stdio(false);
    solve();
    return 0;
}


#include <iostream>
#include <sstream>
#include <cstdio>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <utility>
#include <cassert>
#include <numeric>
#include <sstream>
using namespace std;

#define REQUIRE(cond, message) \
    do { \
        if (!(cond)) { \
            std::cerr << message << std::endl; \
            assert(false); \
        } \
    } while (false)

#define forn(i, n) for (int i = 0; i < int(n); ++i)
#define for1(i, n) for (int i = 1; i <= int(n); ++i)
#define forv(i, v) forn(i, (v).size())
#define pb push_back
#define mp make_pair
#define all(v) (v).begin(), (v).end()

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long long ll;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef vector<string> vs;
typedef long double ld;
const vi dx = {1, -1, 0, 0, 0, 0};
const vi dy = {0, 0, 1, -1, 0, 0};
const vi dz = {0, 0, 0, 0, 1, -1};
int k, n, m;
bool isInside(int x, int y, int z)
{
    return x >= 0 && y >= 0 && z >= 0 &&
           z < k && x < n && y < m;
}
typedef vector<bool> vb;
vector<vs> plate;
vector<vector<vb> > used;
int dfs(int x, int y, int z)
{
    used[x][y][z] = true;
    int cnt = 1;
    forv(i, dx) {
        int xx = x + dx[i];
        int yy = y + dy[i];
        int zz = z + dz[i];
        if (isInside(xx, yy, zz) && !used[xx][yy][zz] &&
            plate[xx][yy][zz] == '.') {
            cnt += dfs(xx, yy, zz);
        }
    }
    return cnt;
}

void solve()
{
    cin >> k >> n >> m;
    plate.resize(n);
    used.resize(n);
    forn(i, n) used[i].resize(m, vb(m));
    forn(i, n) plate[i].resize(m, string(m, '#'));
    forn(i, k) {
        string s;
        forn(j, n) {
            cin >> s;
            forv(l, s) {
                plate[j][l][i] = s[l];
            }
        }
    }
    int x, y; cin >> x >> y;
    --x, --y;
    cout << dfs(x, y, 0) << endl;
}

int main()
{
    ios_base::sync_with_stdio(false);
    solve();
    return 0;
}


#include <iostream>
#include<queue>
using namespace std;
struct cosa {
 int x;
int y;
int z;
};
char mapa[11][11][11];
queue <cosa> busca;
bool checa[11][11][11];
int vec[6][3]={{0,1,0},{0,-1,0},{1,0,0},{-1,0,0},{0,0,1},{0,0,-1}};
int main() {
long long int n,m,k,i,j,h,cont,x1,y1,a,b,c;
cosa aux,aux2;
cin>>k>>n>>m;
for(i=1;i<=k;i++){
  for(j=1;j<=n;j++){
   for(h=1;h<=m;h++){
 cin>>mapa[i][j][h];
}
}
}
cin>>x1>>y1;
cont=0;
aux.x=x1;
aux.y=y1;
aux.z=1;
checa[aux.z][aux.x][aux.y]=true;
busca.push(aux);
while(!busca.empty()){
  aux=busca.front();
 for(i=0;i<6;i++){
  a=aux.x+vec[i][0];
b=aux.y+vec[i][1];
c=aux.z+vec[i][2];
if(a>=1&&a<=n&&b>=1&&b<=m&&c>=1&&c<=k){
 if(checa[c][a][b]==false&&mapa[c][a][b]=='.'){
 checa[c][a][b]=true;
aux2.x=a;
aux2.y=b;
aux2.z=c;
busca.push(aux2);
}
}
}
cont++;
busca.pop();
}
cout<<cont;
    return 0;
}


#include <stdio.h>
#include <vector>
#define IN(a)       scanf("%d", &a)
#define IN2(a, b)   scanf("%d%d", &a, &b)
#define IN3(a,b, c) scanf("%d%d%d", &a, &b, &c)
#define OUT(a)      TESTING(printf("OUT:\t");) printf("%d\n", a)
#define TOUT(a)     TESTING(printf("TEST:\t\t%d", a))
#define ENDL        printf("\n")
#define FOR0(n)     for(int i=0; i<n; i++)
#define FOR1(n)     for(int i=1; i<=n; i++)
#define FOR(a, b)   for(int i=a; i<=b; i++)
#define min(a, b)   a<b?a:b
#define max(a, b)   a>b?a:b
#define mnc(mn, c)  if(mn<c) mn=c
#define mxc(mx, c)  if(mx>c) mx=c
#define INF         1<<30
#define ll long long
#define TESTING(ON)
using namespace std;
bool vis[11][11][11];
int n, m, k, sx, sy, cnt;
char s[11][11][11];
int dx[] = {1, 0, 0, -1, 0, 0};
int dy[] = {0, 1, 0, 0, -1, 0};
int dz[] = {0, 0, 1, 0, 0, -1};
void dfs(int x, int y, int z)
{
    if(x<0||x>=n||y<0||y>=m||z<0||z>=k||vis[x][y][z]||s[x][y][z]=='#') return;
    vis[x][y][z]=true;
    cnt++;
    FOR0(6)
    {
        dfs(x+dx[i], y+dy[i], z+dz[i]);
    }
}
int main()
{
    IN3(n, m, k);
    for(int x=0; x<n; x++){
        for(int y=0; y<m; y++){
            scanf("%s", s[x][y]);
        }
    }
    IN2(sx, sy);
    dfs(0, sx-1, sy-1);
    OUT(cnt);
    return 0;
}


// #define DEBUG
//#define USEPB_DS
#define USETR1
#define CPPELEVEN
#define GPP

/*
 * temp.cpp
 *
 *  Created on: 2012-7-18
 *      Author: BSBandme
 */
//#pragma comment(linker, "/STACK:1024000000,1024000000")

#include <iostream>
#include <fstream>
#include <string.h>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <cassert>
#include <list>
#include <iomanip>
#include <math.h>
#include <deque>
#include <utility>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <climits>
#include <cctype>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <functional>
#include <sstream>
#include <tuple>

using namespace std;

#ifndef CPPELEVEN
#ifdef USETR1
#include <tr1/unordered_map>
#include <tr1/unordered_set>
using namespace tr1;
#endif
#else
#include <unordered_map>
#include <unordered_set>
#endif

#ifdef USEPB_DS
#include <ext/pb_ds/priority_queue.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
// binomial_heap_tag, rc_binomial_heap_tag, thin_heap_tag, binary_heap_tag
typedef __gnu_pbds::priority_queue<int, greater<int>, pairing_heap_tag> pq_type;
// splay_tree_tag, ov_tree_tag
typedef tree <int, null_type, less <int>, rb_tree_tag, tree_order_statistics_node_update> tree_type;
#endif

#define mpr make_pair
typedef unsigned int ui;
typedef unsigned long long ull;
typedef long long ll;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <double, double> pdd;
typedef vector <int> vi;
typedef vector <ll> vll;
typedef vector <double> vd;
typedef vector <string> vs;
typedef map <string, int> mpsi;
typedef map <double, int> mpdi;
typedef map <int, int> mpii;

const double pi = acos(0.0) * 2.0;
const long double eps = 1e-10;
const int step[8][2] = {{-1, 0}, {0, 1}, {1, 0}, {0, -1}, {-1, 1}, {1, 1}, {1, -1}, {-1, -1}};

template <class T> inline T abs1(T a) {return a < 0 ? -a : a;}

#ifndef CPPELEVEN
template <class T> inline T max1(T a, T b) { return b < a ? a : b; }
template <class T> inline T max1(T a, T b, T c) { return max1(max1(a, b), c); }
template <class T> inline T max1(T a, T b, T c, T d) { return max1(max1(a, b, c), d); }
template <class T> inline T max1(T a, T b, T c, T d, T e) { return max1(max1(a, b, c, d), e); }
template <class T> inline T min1(T a, T b) { return a < b ? a : b; }
template <class T> inline T min1(T a, T b, T c) { return min1(min1(a, b), c); }
template <class T> inline T min1(T a, T b, T c, T d) { return min1(min1(a, b, c), d); }
template <class T> inline T min1(T a, T b, T c, T d, T e) { return min1(min1(a, b, c, d), e); }
#else
template <typename t, typename t1>
t min1(t a, t1 b) { return a < b ? a : b; }
template <typename t, typename... arg>
t min1(t a, arg... arr) { return min1(a, min1(arr...)); }
template <typename t, typename t1>
t max1(t a, t1 b) { return a > b ? a : b; }
template <typename t, typename... arg>
t max1(t a, arg... arr) { return max1(a, max1(arr...)); }
#endif

inline int jud(double a, double b){
	if(abs(a) < eps && abs(b) < eps) return 0;
	else if(abs1(a - b) / max(abs1(a), abs1(b)) < eps) return 0;
	if(a < b) return -1;
	return 1;
}
template <typename t> inline int jud(t a, t b){
	if(a < b) return -1;
	if(a == b) return 0;
	return 1;
}

// f_lb == 1代表返回相同的一串的左边界，f_small == 1代表返回如果没有寻找的值返回小的数
template <typename it, typename t1>
inline int find(t1 val, it a, int na, bool f_small = 1, bool f_lb = 1){
	if(na == 0) return 0;
	int be = 0, en = na - 1;
	if(*a <= *(a + na - 1)){
		if(f_lb == 0) while(be < en){
			int mid = (be + en + 1) / 2;
			if(jud(*(a + mid), val) != 1) be = mid;
			else en = mid - 1;
		}else while(be < en){
			int mid = (be + en) / 2;
			if(jud(*(a + mid), val) != -1) en = mid;
			else be = mid + 1;
		}
		if(f_small && jud(*(a + be), val) == 1) be--;
		if(!f_small && jud(*(a + be), val) == -1) be++;
	} else {
		if(f_lb) while(be < en){
			int mid = (be + en + 1) / 2;
			if(jud(*(a + mid), val) != -1) be = mid;
			else en = mid - 1;
		}else while(be < en){
			int mid = (be + en) / 2;
			if(jud(*(a + mid), val) != 1) en = mid;
			else be = mid + 1;
		}
		if(!f_small && jud(*(a + be), val) == -1) be--;
		if(f_small && jud(*(a + be), val) == 1) be++;
	}
	return be;
}

template <class T> inline T lowb(T num) {return num & (-num); }
#ifdef GPP
inline int bitnum(ui nValue) { return __builtin_popcount(nValue); }
inline int bitnum(int nValue) { return __builtin_popcount(nValue); }
inline int bitnum(ull nValue) { return __builtin_popcount(nValue) + __builtin_popcount(nValue >> 32); }
inline int bitnum(ll nValue) { return __builtin_popcount(nValue) + __builtin_popcount(nValue >> 32); }
inline int bitmaxl(ui a) { if(a == 0) return 0; return 32 - __builtin_clz(a); }
inline int bitmaxl(int a) { if(a == 0) return 0; return 32 - __builtin_clz(a); }
inline int bitmaxl(ull a) { int temp = a >> 32; if(temp) return 32 - __builtin_clz(temp) + 32; return bitmaxl(int(a)); }
inline int bitmaxl(ll a) { int temp = a >> 32; if(temp) return 32 - __builtin_clz(temp) + 32; return bitmaxl(int(a)); }
#else
#endif

long long pow(long long n, long long m, long long mod = 0){
	if(m < 0) return 0;
	long long ans = 1;
	long long k = n;
	while(m){
		if(m & 1) {
			ans *= k;
			if(mod) ans %= mod;
		}
		k *= k;
		if(mod) k %= mod;
		m >>= 1;
	}
	return ans;
}

#define  MOD 1000000007
template <class t1, class t2>
inline void add(t1 &a, t2 b, int mod = -1) {
	if(mod == -1) mod = MOD;
	a += b;
	while(a >= mod) a -= mod;
	while(a < 0) a += mod;
}
template <class t>
void output1(t arr) {
	for(int i = 0; i < (int)arr.size(); i++)
		cerr << arr[i] << ' ';
	cerr << endl;
}
template <class t>
void output2(t arr) {
	for(int i = 0; i < (int)arr.size(); i++)
		output1(arr[i]);
}

//....................密..........封..........线..........下..........禁..........止..........hack...............................................

const int maxn = 100100;
double ans;
int n, p;
double v[maxn], h[maxn];

int main() {

//............................不要再忘了检查maxn大小了！！！！BSBandme你个SB！！！！...................................................

	ios_base::sync_with_stdio(0);
	#ifdef DEBUG //......................................................................................................
	freopen("input.txt", "r", stdin);
	int __size__ = 256 << 20; // 256MB
	char *__p__ = (char*)malloc(__size__) + __size__;
	__asm__("movl %0, %%esp\n" :: "r"(__p__));
	#endif //...........................................................................................................

	scanf("%d%d", &n ,&p);
	for(int i = 0 ;i < n; i++) {
		scanf("%lf%lf", v + i, h + i);
	}
	double en = 1e11, be = 0;
	for(int i = 0; i < 100; i++) {
		double mid = (be + en) / 2;
		double less = p;
		for(int i = 0; i < n; i++) {
			less -= max(0.0, v[i]  - h[i] / mid);
		}
		if(jud(less, 0) == -1) en = mid;
		else be = mid;
	}
	if(be > 9.9e10) puts("-1");
	else printf("%.10f\n", be);

    return 0;
}


nclude<bits/stdc++.h>
#define N 100005
using namespace std;
int n,p;
int a[N],b[N];
bool check(long double t){
	long double tot=0;
	for(int i=1;i<=n;i++) if(a[i]*t>b[i]) tot-=b[i]-a[i]*t;
	return t*p>tot-1e-5;
}
int main(){
	scanf("%d%d",&n,&p);
	for(int i=1;i<=n;i++) scanf("%d%d",&a[i],&b[i]);
	long double l=0,r=1e12;
	while(r-l>1e-5){
		long double mid=(l+r)/2;
		if(check(mid)) l=mid;
		else r=mid;
	}
	if(l>5e11) return puts("-1"),0;
	cout<<l<<endl;
	return 0;
}


#include<bits/stdc++.h>
#define N 100005
using namespace std;
int n,p;
int a[N],b[N];
bool check(long double t){
	long double tot=0;
	for(int i=1;i<=n;i++) if(a[i]*t>b[i]) tot-=b[i]-a[i]*t;
	return t*p>tot-1e-5;
}
int main(){
	scanf("%d%d",&n,&p);
	for(int i=1;i<=n;i++) scanf("%d%d",&a[i],&b[i]);
	long double l=0,r=1e12;
	while(r-l>1e-5){
		long double mid=(l+r)/2;
		if(check(mid)) l=mid;
		else r=mid;
	}
	if(l>5e11) return puts("-1"),0;
	cout<<l<<endl;
	return 0;
}


#include<bits/stdc++.h>
#define N 100005
using namespace std;
int n,p;
int a[N],b[N];
bool check(double t){
	double tot=0;
	for(int i=1;i<=n;i++) if(a[i]*t>b[i]) tot-=b[i]-a[i]*t;
	return t*p>tot;
}
int main(){
	scanf("%d%d",&n,&p);
	for(int i=1;i<=n;i++) scanf("%d%d",&a[i],&b[i]);
	double l=0,r=2e5;
	while(r-l>1e-5){
		double mid=(l+r)/2;
		if(check(mid)) l=mid;
		else r=mid;
	}
	if(l>1e5+3) return puts("-1"),0;
	printf("%.5lf",l);
	return 0;
}


#include<bits/stdc++.h>
#define N 100005
using namespace std;
int n,p;
int a[N],b[N];
bool check(long double t){
	long double tot=0;
	for(int i=1;i<=n;i++) if(a[i]*t>b[i]) tot-=b[i]-a[i]*t;
	return t*p>tot-1e-5;
}
int main(){
	scanf("%d%d",&n,&p);
	for(int i=1;i<=n;i++) scanf("%d%d",&a[i],&b[i]);
	long double l=0,r=1e12;
	while(r-l>1e-5){
		double mid=(l+r)/2;
		if(check(mid)) l=mid;
		else r=mid;
	}
	if(l>5e11) return puts("-1"),0;
	printf("%.5lf",l);
	return 0;
}


#include<bits/stdc++.h>
#define N 100005
using namespace std;
int n,p;
int a[N],b[N];
bool check(long double t){
	long double tot=0;
	for(int i=1;i<=n;i++) if(a[i]*t>b[i]) tot-=b[i]-a[i]*t;
	return t*p>tot-1e-5;
}
int main(){
	scanf("%d%d",&n,&p);
	for(int i=1;i<=n;i++) scanf("%d%d",&a[i],&b[i]);
	long double l=0,r=1e12;
	while(r-l>1e-5){
		double mid=(l+r)/2;
		if(check(mid)) l=mid;
		else r=mid;
	}
	if(l>5e11) return puts("-1"),0;
	cout<<l<<endl;
	return 0;
}


#include<bits/stdc++.h>
#define N 100005
using namespace std;
int n,p;
int a[N],b[N];
bool check(long double t){
	long double tot=0;
	for(int i=1;i<=n;i++) if(a[i]*t>b[i]) tot-=b[i]-a[i]*t;
	return t*p>tot-1e-5;
}
int main(){
	scanf("%d%d",&n,&p);
	for(int i=1;i<=n;i++) scanf("%d%d",&a[i],&b[i]);
	double l=0,r=7e6;
	while(r-l>1e-5){
		double mid=(l+r)/2;
		if(check(mid)) l=mid;
		else r=mid;
	}
	if(l>1e6) return puts("-1"),0;
	printf("%.5lf",l);
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); ++i)
typedef vector<int> vi;
typedef long long ll;

const double EPS = 0.00000001;

int n, p;
vi a, b;

bool f(double x)
{
	double r = 0.0;
	rep(i,n)
	{
		if((double)a[i]*x < (double) b[i]) continue;
		double t = (double) b[i] / (double) a[i];
		r += (x-t) * (double) a[i];
	}
	return r < x * (double) p;
}

int main()
{
	ios::sync_with_stdio(0);
	cin>>n>>p;
	a.resize(n);
	b.resize(n);
	rep(i,n) cin>>a[i]>>b[i];
	ll sum = 0;
	rep(i,n) sum+=a[i];
	if(sum - EPS < (ll) p)
	{
		cout<<-1;
		return 0;
	}
	double beg = 0.0, mid, end = 1.0;
	while(f(end)) end *= 2.0;
	while(beg+EPS<end)
	{
		mid = (beg+end)*0.5;
		if(f(mid)) beg = mid;
		else end = mid;
	}
	cout<<beg;
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); ++i)
typedef vector<int> vi;
typedef long long ll;

const double EPS = 0.000001;

int n, p;
vi a, b;

bool f(double x)
{
	double r = 0.0;
	rep(i,n)
	{
		double t = x * (double) a[i] - (double) b[i];
		if(t>0.0) r += t;
	}
	return r < x * (double) p;
}

int main()
{
	ios::sync_with_stdio(0);
	cin>>n>>p;
	a.resize(n);
	b.resize(n);
	rep(i,n) cin>>a[i]>>b[i];
	ll sum = 0;
	rep(i,n) sum+=a[i];
	if(sum <= (ll) p)
	{
		cout<<-1;
		return 0;
	}
	double beg = 0.0, mid, end = 1.0;
	while(f(end))
	{
		beg = end;
		end *= 2.0;
	}
	while(beg+EPS<end)
	{
		mid = (beg+end)*0.5;
		if(f(mid)) beg = mid;
		else end = mid;
	}
	cout<<beg;
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); ++i)
typedef vector<int> vi;
typedef long long ll;

const double EPS = 0.00001;

int n, p;
vi a, b;

bool f(double x)
{
	double r = 0.0;
	rep(i,n)
	{
		double t = x * (double) a[i] - (double) b[i];
		if(t>0.0) r += t;
	}
	return r < x * (double) p;
}

int main()
{
	ios::sync_with_stdio(0);
	cin>>n>>p;
	a.resize(n);
	b.resize(n);
	rep(i,n) cin>>a[i]>>b[i];
	ll sum = 0;
	rep(i,n) sum+=a[i];
	if(sum <= (ll) p)
	{
		cout<<-1;
		return 0;
	}
	double beg = 0.0, mid, end = 1.0;
	while(f(end))
	{
		beg = end;
		end *= 2.0;
	}
	while(beg+EPS<end)
	{
		mid = (beg+end)*0.5;
		if(f(mid)) beg = mid;
		else end = mid;
	}
	cout<<beg;
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); ++i)
typedef vector<int> vi;
typedef long long ll;

const double EPS = 0.0000001;

int n, p;
vi a, b;

bool f(double x)
{
	double r = 0.0;
	rep(i,n)
	{
		if((double)a[i]*x < (double) b[i]) continue;
		double t = (double) b[i] / (double) a[i];
		r += (x-t) * (double) a[i];
	}
	return r < x * (double) p;
}

int main()
{
	ios::sync_with_stdio(0);
	cin>>n>>p;
	a.resize(n);
	b.resize(n);
	rep(i,n) cin>>a[i]>>b[i];
	ll sum = 0;
	rep(i,n) sum+=a[i];
	if(sum - EPS < (ll) p)
	{
		cout<<-1;
		return 0;
	}
	double beg = 0.0, mid, end = 1.0;
	while(f(end))
	{
		beg = end;
		end *= 2.0;
	}
	while(beg+EPS<end)
	{
		mid = (beg+end)*0.5;
		if(f(mid)) beg = mid;
		else end = mid;
	}
	cout<<beg;
	return 0;
}


//============================================================================
// Name        : firstTrial.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 20;
#define EPS 1e-9
int a[N], b[N];
bool check(long double mid, int n, int p){
	long double chTime = 0;
	for(int i = 0; i < n; i++){
		chTime += (max(a[i] * mid - b[i], (long double)0.0));
	}
	if(chTime - EPS < mid * p)
		return 1;
	return 0;
}
int main(){
// 	setvbuf(stdout, NULL, _IONBF, 0);
	int n, p;
	cin >> n >> p;
	for(int i = 0; i < n; i++)
		cin >> a[i] >> b[i];
	long long int s = 0;
	for(int i = 0; i < n; i++)
		s += a[i];
	if(s <= p)
		return cout << "-1\n", 0;
	long double l = 0, r = 1e11, ans = 0;
	for(int i = 0; i < 200; i++){
		long double mid = (l + r) / 2;
		if(check(mid, n, p))
			ans = mid, l = mid;
		else
			r = mid;

	}
	if(ans > 1e10 + 20)
		cout << "-1\n";
	else
		cout << fixed << setprecision(10) << ans << '\n';
	return 0;
}


//============================================================================
// Name        : firstTrial.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 20;
#define EPS 1e-9
int a[N], b[N];
bool check(long double mid, int n, int p){
	long double chTime = 0;
	for(int i = 0; i < n; i++){
		chTime += max(a[i] * mid - b[i], (long double)0.0);
	}
	if(chTime - EPS < mid * p)
		return 1;
	return 0;
}
int main(){
	setvbuf(stdout, NULL, _IONBF, 0);
	int n, p;
	cin >> n >> p;
	for(int i = 0; i < n; i++)
		cin >> a[i] >> b[i];
	long double l = 0, r = 1e20, ans = 0;
	for(int i = 0; i < 200; i++){
		long double mid = (l + r) / 2;
		if(check(mid, n, p))
			ans = mid, l = mid;
		else
			r = mid;

	}
	if(ans > 1e20 - 2)
		cout << "-1\n";
	else
		cout << setprecision(10) << ans << '\n';
	return 0;
}