program check;

uses
	testlib, sysutils;

const
	maxn = 200001;

var
	v: array [1..maxn] of longint;
	s, i, j, n, pa: longint;
	
begin
	n := 0;
	while not inf.seekeof do begin
		inc(n);
		v[n] := ord(inf.nextchar) - ord('0');
	end;

	pa := ouf.readlongint;

	if pa = 0 then
		quit(_wa, 'answer not found');

	if (pa < 1) or (pa > n) then
		quit(_wa, 'invalid number: ' + inttostr(pa));

	j := 1;
	s := 0;
	for i := 1 to n do begin
		if (i = pa) then continue;
		if j mod 2 = 1 then
			s := s + v[i]
		else
			s := s - v[i];
		inc(j);
	end;

	if (s <> 0) then
		quit(_wa, 'resulting sequence is not fair');

	quit(_ok, 'n = ' + inttostr(n) + ', ans = ' + inttostr(pa));
end.