#include <cstdio>
#include <vector>
#include <algorithm>
#include <cstring>
#include <string>
#include <cctype>
#include <sstream>
#include <cmath>
#include <climits>
#include <set>
#include <iostream>
#include <map>
#include <functional>
#include <cstdlib>

using namespace std;

#define reep(i,f,n) for(int i=f; i<int(n); ++i)
#define rep(i,n) reep(i,0,n)

typedef vector<int> vi;
typedef pair<int, int> pii;

int main()
{
	int n, m, s, d;
	while(scanf("%d%d%d%d", &n, &m, &s, &d) == 4){
		--s; --m;
		vector<string> hori(d);
		rep(i, d) cin >> hori[i];

		vi res(n);
		rep(i, n) res[i] = i;
		rep(i, d) rep(j, n-1)
			if(hori[i][j] == '1')
				swap(res[j], res[j+1]);
		s = res[s];
		if(s == m){
			puts("0");
			continue;
		}
		
		pii result(-1, -1);
		rep(i, n) res[i] = i;
		rep(i, d) rep(j, n-1){
			if(hori[i][j] == '1')
				swap(res[j], res[j+1]);
			else{
				if(!((res[j]==s && res[j+1]==m) || (res[j]==m && res[j+1]==s)))
					continue;
				if((j && hori[i][j-1]=='1') || (j<n-1 && hori[i][j+1]=='1'))
					continue;
				result = pii(i+1, j+1);
				i=d; break;
			}
		}

		if(result.first == -1)
			puts("1");
		else
			printf("%d %d\n", result.first, result.second);
	}
}