#include<iostream>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<set>
using namespace std;
set<double> s;
int n,m,a,b;
int main()
{
cin>>m>>n>>a>>b;
for(int i=a;i<n+a;i++)
{
for(int j=b;j<b+m;j++)
{
double t=(double)j*log2(1.0*i);
s.insert(t);
}
}
cout<<s.size()<<endl;
return 0;
}