#include<bits/stdc++.h>
using namespace std;
#define fp(i,l,r) for(register int (i)=(l);(i)<=(r);++(i))
#define fd(i,l,r) for(register int (i)=(l);(i)>=(r);--(i))
#define fe(i,u) for(register int (i)=front[(u)];(i);(i)=e[(i)].next)
#define mem(a) memset((a),0,sizeof (a))
#define O(x) cerr<<#x<<':'<<x<<endl
inline int read(){
    int x=0,f=1;char ch=getchar();
    while(!isdigit(ch)){if(ch=='-')f=-1;ch=getchar();}
    while(isdigit(ch))x=x*10+ch-'0',ch=getchar();
    return x*f;
}
void wr(int x){
    if(x<0)putchar('-'),x=-x;
    if(x>=10)wr(x/10);
    putchar('0'+x%10);
}
const int MAXN=1005;
int N,M,n,mp[MAXN];
bool T,dp[MAXN];
inline bool calc(int l,int r,int t){
    if(T)printf("? %d %d %d %d %d %d\n",N,t,1,l,1,r);
    else printf("? %d %d %d %d %d %d\n",t,M,l,1,r,1);
    fflush(stdout);
    return read();
}
inline bool ask(int t,int len){
    if(t==2)return calc(1,len+1,len);
    int mid=len*(t/2);
    return calc(1,mid+len+1,mid)&&calc(1,mid+1,mid);
}
inline int solve(){
    int t=n;
    for(int i=n;i>1;i/=mp[i])if(ask(mp[i],t/mp[i]))t/=mp[i];
    t=n/t;int ans=0;
    fp(i,1,t)if(t%i==0)++ans;
    return ans;
}
int main(){
    N=read();M=read();
    fd(i,1000,2)fp(j,1,1000/i)mp[i*j]=i;
    T=0;n=N;int t1=solve();
    T=1;n=M;int t2=solve();
    printf("! %d\n",t1*t2);fflush(stdout);
    return 0;
}
