Let *a* be an array consisting of *n* numbers. The array's elements are numbered from 1 to *n*, *even* is an array consisting of the numerals whose numbers are even in *a* (*even*<sub class="lower-index">*i*</sub> = *a*<sub class="lower-index">2*i*</sub>, 1 ≤ 2*i* ≤ *n*), *odd* is an array consisting of the numberals whose numbers are odd in *а* (*odd*<sub class="lower-index">*i*</sub> = *a*<sub class="lower-index">2*i* - 1</sub>, 1 ≤ 2*i* - 1 ≤ *n*). Then let's define the transformation of array *F*(*a*) in the following manner:
 -  if *n* &gt; 1, *F*(*a*) = *F*(*odd*) + *F*(*even*), where operation " + " stands for the arrays' concatenation (joining together) -  if *n* = 1, *F*(*a*) = *a* 
Let *a* be an array consisting of *n* numbers 1, 2, 3, ..., *n*. Then *b* is the result of applying the transformation to the array *a* (so *b* = *F*(*a*)). You are given *m* queries (*l*, *r*, *u*, *v*). Your task is to find for each query the sum of numbers *b*<sub class="lower-index">*i*</sub>, such that *l* ≤ *i* ≤ *r* and *u* ≤ *b*<sub class="lower-index">*i*</sub> ≤ *v*. You should print the query results modulo *mod*.
The first line contains three integers *n*, *m*, *mod* (1 ≤ *n* ≤ 10<sup class="upper-index">18</sup>, 1 ≤ *m* ≤ 10<sup class="upper-index">5</sup>, 1 ≤ *mod* ≤ 10<sup class="upper-index">9</sup>). Next *m* lines describe the queries. Each query is defined by four integers *l*, *r*, *u*, *v* (1 ≤ *l* ≤ *r* ≤ *n*, 1 ≤ *u* ≤ *v* ≤ 10<sup class="upper-index">18</sup>).

Please do not use the %lld specificator to read or write 64-bit integers in C++. Use %I64d specificator.
hioxhfhsfhasoihonshifhioshoifhsaiofoshofhsaiohfoisahfioashoi
ksnjldkjsa
			 		  	  	  		 			     	 	 		