type
	integer = longint;
var
	fout, fans: text;

procedure points(p: integer);
begin
	writeln(p);
	close(fout);
	close(fans);
	halt;
end;

var
	n, m, a, b, i: integer;
begin
	assign(fout, paramstr(2));
	reset(fout);

	assign(fans, paramstr(3));
	reset(fans);

	read(fout, n);
	read(fans, m);

	if n <> m then points(0);

	for i := 1 to n do begin
		read(fout, a);
		read(fans, b);
		if a <> b then points(0);
	end;

	points(10);
end.
