#include<iostream>

int n, m;
int l;
int d;
bool ver[30][8];

int sim( int v )
{
	for( int i = 0; i != d; ++i )
	{
		if( v < n && ver[i][v] )
			++v;
		else if( v > 0 && ver[i][v-1] )
			--v;
	}
	
	return v;
}

int main()
{
	std::cin >> n >> m >> l >> d;
	--m; --l;
	for( int i = 0; i != d; ++i )
	{
		for( int j = 0; j != n - 1; ++j )
		{
			char c;
			std::cin >> c;
			ver[i][j] = c - '0';
		}
	}

	if( sim( m ) == l )
		std::cout << 0 << std::endl;
	else
	{
		bool f = false;

		for( int i = 0; i != d; ++i )
		{
			for( int j = 0; j != n - 1; ++j )
			{
				if( !ver[i][j] )
				{
					ver[i][j] = true;
					if( sim( m ) == l )
					{
						std::cout << i + 1 << " " << j + 1 << std::endl;
						f = true;
						goto end;
					}
					ver[i][j] = false;
				}
			}
		}

	end:;

		if( !f )
			std::cout << 1 << std::endl;
	}

	return 0;
}