#include<bits/stdc++.h>
using namespace std;
char in[100], out[100];
int n,m,e1,e2;
int f(int s1, int s2){
	if(s1==e1 and s2==e2) return 1;
	if(s2>e2 or float(m)/n*s2 < s1 or s1 > e1) return 0;
	if(s2%2) return f(s1+1,s2)+f(s1+1,s2+1)+f(s1,s2+1); 
	else return f(s1+1,s2)+f(s1,s2+1); 
}
int main(){
	int s1,s2,k;
	srand((unsigned int)time(NULL));
	for(int I=6;I<7;I++){
		sprintf(in,".%d.in",I);
	    freopen(in,"w",stdout);
	    //cin >> n >> m >> s1 >> s2 >> e1 >> e2;
		n = 20; 
		m = 20; 
		s1 = rand()%(n+1);
		s2 = rand()%(m+1);
		e1 = rand()%(n+1);
		e2 = rand()%(m+1);
		cout << n <<" "<<m <<endl;
		cout << s1 <<" " << s2 <<" "<< e1 <<" "<< e2 << endl; 
		sprintf(out,".%d.out",I);
	    freopen(out,"w",stdout);
		k = f(s1, s2);
		cout << k;
		if(k==0) I--;
	}
}
