#include<iostream>
#include<vector>
using namespace std;
vector<vector<int>> x(50, vector<int>(50, 0));
int Div[51],K;
inline int solve() {
int q = 1, p = 0;
for (int i = 0; i < 50; i++) {
for (int j = 0; j < 50; j++) {
if (x[i][j] == 1)p += q;
q *= 2; q %= K; p %= K;
}
}
return p;
}
inline int Query(int i1, int i2, int i3, int i4) {
cout << "? " << i1 << ' ' << i2 << ' ' << i3 << ' ' << i4 << endl;
int Va; cin >> Va;
return Va;
}
inline void solve2(int row, int col, int p1) {
int i = row, j = col;
if (p1 == 0) { x[i][j] = 0; x[i][j + 1] = 0; x[i + 1][j] = 0; x[i + 1][j + 1] = 0; }
else if (p1 == 4) { x[i][j] = 1; x[i][j + 1] = 1; x[i + 1][j] = 1; x[i + 1][j + 1] = 1; }
else {
int p2 = Query(i, j, i, j + 1), p3 = p1 - p2;
if (p2 == 0) { x[i][j] = 0; x[i][j + 1] = 0; }
if (p2 == 2) { x[i][j] = 1; x[i][j + 1] = 1; }
if (p2 == 1) { x[i][j] = Query(i, j, i, j); x[i][j + 1] = 1 - x[i][j]; }
if (p3 == 0) { x[i + 1][j] = 0; x[i + 1][j + 1] = 0; }
if (p3 == 2) { x[i + 1][j] = 1; x[i + 1][j + 1] = 1; }
if (p3 == 1) { x[i + 1][j] = Query(i + 1, j, i + 1, j); x[i + 1][j + 1] = 1 - x[i + 1][j]; }
}
}
inline void saiki(int row, int col, int hs, int ws, int p1) {
if (row >= 50 || col >= 50)return;
if (hs == 2 && ws == 2) { solve2(row, col, p1); return; }
if (hs > ws) {
int E1 = p1;
int EE1, EE2;
if (E1 == hs*ws) { EE1 = ws*Div[hs]; EE2 = ws*(hs - Div[hs]); }
else if (E1 == 0) { EE1 = 0; EE2 = 0; }
else { EE1 = Query(row, col, row + Div[hs] - 1, col + ws - 1); EE2 = E1 - EE1; }
saiki(row, col, Div[hs], ws, EE1);
saiki(row + Div[hs], col, hs - Div[hs], ws, EE2);
}
else {
int E1 = p1;
int EE1, EE2;
if (E1 == hs*ws) { EE1 = hs*Div[ws]; EE2 = hs*(ws - Div[ws]); }
else if (E1 == 0) { EE1 = 0; EE2 = 0; }
else { EE1 = Query(row, col, row + hs - 1, col + Div[ws] - 1); EE2 = E1 - EE1; }
saiki(row, col, hs, Div[ws], EE1);
saiki(row, col + Div[ws], hs, ws - Div[ws], EE2);
}
}
int main() {
int H, W, N; cin >> H >> W >> N>>K;
for (int i = 1; i <= 50; i++) {
if (i > 32)Div[i] = 32;
else if (i > 16)Div[i] = 16;
else if (i > 8)Div[i] = 8;
else if (i > 4)Div[i] = 4;
else if (i > 2)Div[i] = 2;
else if (i > 1)Div[i] = 1;
}
saiki(0, 0, 50, 50, 250);
cout << "! " << solve() << endl;
return 0;
}
I2luY2x1ZGU8aW9zdHJlYW0+CiNpbmNsdWRlPHZlY3Rvcj4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKdmVjdG9yPHZlY3RvcjxpbnQ+PiB4KDUwLCB2ZWN0b3I8aW50Pig1MCwgMCkpOwppbnQgRGl2WzUxXSxLOwppbmxpbmUgaW50IHNvbHZlKCkgewoJaW50IHEgPSAxLCBwID0gMDsKCWZvciAoaW50IGkgPSAwOyBpIDwgNTA7IGkrKykgewoJCWZvciAoaW50IGogPSAwOyBqIDwgNTA7IGorKykgewoJCQlpZiAoeFtpXVtqXSA9PSAxKXAgKz0gcTsKCQkJcSAqPSAyOyBxICU9IEs7IHAgJT0gSzsKCQl9Cgl9CglyZXR1cm4gcDsKfQppbmxpbmUgaW50IFF1ZXJ5KGludCBpMSwgaW50IGkyLCBpbnQgaTMsIGludCBpNCkgewoJY291dCA8PCAiPyAiIDw8IGkxIDw8ICcgJyA8PCBpMiA8PCAnICcgPDwgaTMgPDwgJyAnIDw8IGk0IDw8IGVuZGw7CglpbnQgVmE7IGNpbiA+PiBWYTsKCXJldHVybiBWYTsKfQppbmxpbmUgdm9pZCBzb2x2ZTIoaW50IHJvdywgaW50IGNvbCwgaW50IHAxKSB7CglpbnQgaSA9IHJvdywg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