#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
typedef long long ll;

std::vector<std::pair<ll,ll> > p;
ll a,b,c,d,px,py,pz;
const int Mod=1000000007;

inline bool Cmp(const std::pair<ll,ll> &a,const std::pair<ll,ll> &b){return a.first*b.second<a.second*b.first;}

int main()
{
    std::ios::sync_with_stdio(false);
    std::cin.tie(0),std::cout.tie(0);
    std::cin>>a>>b>>c>>d;
    for(int i=0;i<=d;++i)
    {
        if(i<a)p.push_back(std::make_pair(i,a)),p.push_back(std::make_pair(a-i-1,a));
        if(i<b)p.push_back(std::make_pair(i,b)),p.push_back(std::make_pair(b-i-1,b));
        if(i<c)p.push_back(std::make_pair(i,c)),p.push_back(std::make_pair(c-i-1,c));
    }
    std::sort(p.begin(),p.end(),Cmp);
    ll Ans=(std::min(a-1,d)+1)*(std::min(b-1,d)+1)*(std::min(c-1,d)+1);
    for(int i=1;i<(int)p.size();++i)
    {
        ll nx=a*p[i].first/p[i].second;
        ll ny=b*p[i].first/p[i].second;
        ll nz=c*p[i].first/p[i].second;
        ll dx=std::min(a-1,px+d)-std::max(0ll,px-d)+1;
        ll dy=std::min(b-1,py+d)-std::max(0ll,py-d)+1;
        ll dz=std::min(c-1,pz+d)-std::max(0ll,pz-d)+1;
        if(nx+d<a)Ans+=(nx-px)*dy%Mod*dz%Mod;
        if(ny+d<b)Ans+=(ny-py)*dz%Mod*dx%Mod;
        if(nz+d<c)Ans+=(nz-pz)*dx%Mod*dy%Mod;
        px=nx,py=ny,pz=nz;
    }
    std::cout<<Ans%Mod<<std::endl;
    return 0;
}