#include<bits/stdc++.h>
#define For(i,a,b) for(register int i=(a);i<=(b);++i)
#define Rep(i,a,b) for(register int i=(a);i>=(b);--i)
using namespace std;
inline int read()
{
    char c=getchar();int x=0;bool f=0;
    for(;!isdigit(c);c=getchar())f^=!(c^45);
    for(;isdigit(c);c=getchar())x=(x<<1)+(x<<3)+(c^48);
    if(f)x=-x;return x;
}
#define fi first
#define se second
#define pb push_back
#define mkp make_pair
typedef pair<int,int>pii;
typedef vector<int>vi;

#define mod 1000000007
struct modint{
    int x;
    modint(int o=0){x=o;}
    modint &operator = (int o){return x=o,*this;}
    modint &operator +=(modint o){return x=x+o.x>=mod?x+o.x-mod:x+o.x,*this;}
    modint &operator -=(modint o){return x=x-o.x<0?x-o.x+mod:x-o.x,*this;}
    modint &operator *=(modint o){return x=1ll*x*o.x%mod,*this;}
    modint &operator ^=(int b){
        modint a=*this,c=1;
        for(;b;b>>=1,a*=a)if(b&1)c*=a;
        return x=c.x,*this;
    }
    modint &operator /=(modint o){return *this *=o^=mod-2;}
    modint &operator +=(int o){return x=x+o>=mod?x+o-mod:x+o,*this;}
    modint &operator -=(int o){return x=x-o<0?x-o+mod:x-o,*this;}
    modint &operator *=(int o){return x=1ll*x*o%mod,*this;}
    modint &operator /=(int o){return *this *= ((modint(o))^=mod-2);}
    template<class I>friend modint operator +(modint a,I b){return a+=b;}
    template<class I>friend modint operator -(modint a,I b){return a-=b;}
    template<class I>friend modint operator *(modint a,I b){return a*=b;}
    template<class I>friend modint operator /(modint a,I b){return a/=b;}
    friend modint operator ^(modint a,int b){return a^=b;}
    friend bool operator ==(modint a,int b){return a.x==b;}
    friend bool operator !=(modint a,int b){return a.x!=b;}
    bool operator ! () {return !x;}
    modint operator - () {return x?mod-x:0;}
};

#define maxn 10005
int n,m,mp[maxn],mx;
inline void prework(int n){
	For(i,1,n)mp[i]=i;
	For(i,2,n)for(int j=i+i;j<=n;j+=i)mp[j]=min(mp[j],i);
}

bool typ;
inline int ask(int pl,int pr,int len)
{
	if(typ)cout<<"? "<<n<<' '<<len<<' '<<1<<' '<<pl<<' '<<1<<' '<<pr<<endl;
	else cout<<"? "<<len<<' '<<m<<' '<<pl<<' '<<1<<' '<<pr<<' '<<1<<endl;
	int x;cin>>x;return x; 
}

bool chk(int p,int r)
{
	if(p==2)return ask(1,r+1,r);
	if(p==3)return ask(1,r+1,r)&&ask(1,r<<1|1,r);
	int mid=(p/2)*r;
	return ask(1,mid+1+r,mid) && ask(1,mid+1,mid);
}

signed main()
{
	cin>>n>>m; prework(max(n,m));
	int now=n,cntn=0,cntm=0;
	for(int i=n;i>1;i/=mp[i])
		if(chk(mp[i],now/mp[i])) now/=mp[i];
	now=n/now;
	For(i,1,now)if(now%i==0)cntn++;
	now=m; typ=1;
	for(int i=m;i>1;i/=mp[i])
		if(chk(mp[i],now/mp[i])) now/=mp[i];
	now=m/now;
	For(i,1,now)if(now%i==0)cntm++;
	cout<<"! "<<1ll*cntn*cntm<<endl;
	return 0;
}