#include<bits/stdc++.h>
using namespace std;
char in[100], out[100];
int n,m,e1,e2;
int f(int s1, int s2){
	if(s2>e2 or float(m)/n*s2 < s1 or s1 > e1) return 0;
	if(s1==e1 and s2==e2) return 1;
	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;
	cin >>  m >> n >> s1 >> s2 >> e1 >> e2;
	k = f(s1, s2);
	cout << k;
}
