#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int n,m,l,r;
int gcd(int x,int y){
if (y==0)return x;
return gcd(y,x%y);
}
int main(){
freopen ("rockboard.in","r",stdin);
freopen ("rockboard.out","w",stdout);
scanf("%d%d%d%d",&n,&m,&l,&r);
ll ans=0;
for (int i=1;i<=n;i++){
for (int j=1;j<=m;j++){
if (gcd(i,j)!=1||i*i+j*j<=l*l||i*i+j*j>=r*r)continue;
ans+=2ll*(n-i+1)*(m-j+1);
}
}
printf("%lld\n",ans);
return 0;
}