#include <bits/stdc++.h>
#define i64 long long
#define sz(a) int ((a).size())
#define rep(i, a, b) for (int i = (a); i < (b); ++i)
#define per(i, a, b) for (int i = (b) - 1; i >= (a); --i)
using namespace std;
const int inf32 = 0x3f3f3f3f;
const i64 inf64 = 0x3f3f3f3f3f3f3f3f;

const int N = 1000;
int n, m, W, H, res; 

bool ask(int w, int h, int ax,
int ay, int bx, int by) {
	cout << "? " << w << ' ' << h << ' '
	<< ax + 1 << ' ' << ay + 1 << ' '
	<< bx + 1 << ' ' << by + 1 << endl;
	bool same;
	cin >> same;
	return same;
}

int np, p[N], c[N];

void Split(int n) {
	np = 0;
	for (int i = 2; i * i <= n; ++i) {
		if (n % i) continue;
		p[np] = i, c[np] = 0;
		while (n % i == 0) {
			n /= i;
			++c[np];
		}
		++np;
	}
	if (n > 1) {
		p[np] = n;
		c[np] = 1;
		++np;
	}
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cin >> n >> m;
	W = n;
	H = m;
	Split(n);
	rep(i, 0, np) {
		bool ok = true;
		while (ok and c[i]--) {
			int w = W / p[i];
			while (w * 2 <= W) {
				ok &= ask(w, m, 0, 0, w, 0);
				if (not ok) break;
				w *= 2;
			}
			if (ok and W - w > 0)
				ok = ask(W - w, m, 0, 0, w, 0);
			if (ok) W /= p[i];
		}
	}
	Split(m);
	rep(i, 0, np) {
		bool ok = true;
		while (ok and c[i]--) {
			int h = H / p[i];
			while (h * 2 <= H) {
				ok &= ask(n, h, 0, 0, 0, h);
				if (not ok) break;
				h *= 2;
			}
			if (ok and H - h > 0)
				ok = ask(n, H - h, 0, 0, 0, h);
			if (ok) H /= p[i];
		}
	}
	rep(w, 1, n + 1) if (n % w == 0)
		rep(h, 1, m + 1) if (m % h == 0)
			if (w % W == 0 and h % H == 0)
				++res;
	cout << "! " << res << '\n';
	return 0;
}
