// Give you some time for phone calls to work, and then give you another time period for monitoring, ask how many calls can be monitored, as long as there are overlapping time periods, even if there is monitoring .. Simple question ..
# Include <iostream>
# Include <stdio. h>
Using namespace STD;
Struct phone
{
Int source;
Int des;
Int start;
Int;
};
Phone phone [10001];
Int main ()
{
Int n, m;
Int I, J;
Int start, end;
Int;
Int sum;
While (scanf ("% d", & N, & M )! = EOF)
{
If (n = 0 & M = 0)
Break;
For (I = 0; I <n; I ++)
{
Scanf ("% d", & phone [I]. source, & phone [I]. des, & phone [I]. start, & phone [I]. during );
}
For (I = 0; I <m; I ++)
{
Sum = 0;
Scanf ("% d", & START, & );
End = start +;
For (j = 0; j <n; j ++)
{
If (phone [J]. Start <start & phone [J]. Start + phone [J]. During> start)
Sum ++;
If (phone [J]. Start = start)
Sum ++;
If (phone [J]. Start> Start & start + during> phone [J]. Start)
Sum ++;
}
Printf ("% d \ n", sum );
}
}
Return 0;
}