#include <iostream>
#include <cassert>
#include <vector>
#include <tuple>
#include <algorithm>
using namespace std;
using ll=long long;
using ti5=tuple<int, int, int, int, ll>;
const int MN=613;
const int inf32=1e9;
const ll inf64=1e18;
int N, H, W; ll X;
vector<ti5> qry;
vector<ll> vecrow, veccol;
ll orgrow[MN], orgcol[MN];
ll minrow=inf64, maxrow=-inf64, mincol=inf64, maxcol=-inf64, val[MN][MN];
int main()
{
cin>>H>>W>>N>>X;
while (N--)
{
int U, D, L, R; ll C; cin>>U>>D>>L>>R>>C; D++; R++;
vecrow.push_back(U); vecrow.push_back(D);
veccol.push_back(L); veccol.push_back(R);
qry.push_back({U, D, L, R, C});
}
sort(vecrow.begin(), vecrow.end());
vecrow.erase(unique(vecrow.begin(), vecrow.end()), vecrow.end());
sort(veccol.begin(), veccol.end());
veccol.erase(unique(veccol.begin(), veccol.end()), veccol.end());
for (auto &[U, D, L, R, C]:qry)
{
int o;
o=U;
U=lower_bound(vecrow.begin(), vecrow.end(), U)-vecrow.begin()+1;
orgrow[U]=o;
o=D;
D=lower_bound(vecrow.begin(), vecrow.end(), D)-vecrow.begin()+1;
orgrow[D]=o;
o=L;
L=lower_bound(veccol.begin(), veccol.end(), L)-veccol.begin()+1;
orgcol[L]=o;
o=R;
R=lower_bound(veccol.begin(), veccol.end(), R)-veccol.begin()+1;
orgcol[R]=o;
}
for (auto &[U, D, L, R, C]:qry)
{
for (int i=U; i<D; i++)
{
for (int j=L; j<R; j++)
{
val[i][j]+=C;
if (val[i][j]>=X)
{
minrow=min(minrow, orgrow[i]);
maxrow=max(maxrow, orgrow[i+1]-1);
mincol=min(mincol, orgcol[j]);
maxcol=max(maxcol, orgcol[j+1]-1);
}
}
}
if (minrow==inf64) cout<<0<<endl;
else cout<<(maxrow-minrow+1)*(maxcol-mincol+1)<<endl;
}
return 0;
}