code = r"""

# distutils: language=c++

# distutils: include_dirs=[/home/contestant/.local/lib/python3.8/site-packages/numpy/core/include, /opt/atcoder-stl]

# cython: boundscheck=False

# cython: wraparound=False



cdef extern from "/opt/atcoder-stl/atcoder/math.hpp" namespace "atcoder":

    cdef long long floor_sum(long long n, long long m, long long a, long long b)



from libc.stdio cimport scanf, printf

cdef int t, i

cdef long long n, m, a, b

scanf('%d', &t)

for i in range(t):

    scanf('%lld%lld%lld%lld', &n, &m, &a, &b)

    printf('%lld\n', floor_sum(n, m, a, b))

"""

import os, sys

if sys.argv[-1] == 'ONLINE_JUDGE':

    open('solve.pyx', 'w').write(code)

    os.system('cythonize -i -3 -b solve.pyx')

import solve
code = r"""

# distutils: language=c++

# distutils: include_dirs=[/home/contestant/.local/lib/python3.8/site-packages/numpy/core/include, /opt/atcoder-stl]

# cython: boundscheck=False

# cython: wraparound=False

from libc.stdio cimport getchar, printf

cdef extern from "/opt/atcoder-stl/atcoder/math.hpp" namespace "atcoder":

    cdef long long floor_sum(long long n, long long m, long long a, long long b)

cdef long long cin() nogil:

    cdef long long b, c = 0

    while 1:

        b = getchar() - 48

        if b < 0: break

        c = c * 10 + b

    return c

cdef int i, t = cin()

cdef long long n, m, a, b

for i in range(t):

    n = cin()

    m = cin()

    a = cin()

    b = cin()

    printf('%lld\n', floor_sum(n, m, a, b))

"""

import os, sys

if sys.argv[-1] == 'ONLINE_JUDGE':

    open('solve.pyx', 'w').write(code)

    os.system('cythonize -i -3 -b solve.pyx')

import solve
code = r"""
# distutils: language=c++
# distutils: include_dirs=[/home/contestant/.local/lib/python3.8/site-packages/numpy/core/include, /opt/atcoder-stl]
# cython: boundscheck=False
# cython: wraparound=False
cdef extern from "/opt/atcoder-stl/atcoder/math.hpp" namespace "atcoder":
    cdef long long floor_sum(long long n, long long m, long long a, long long b)
from libc.stdio cimport scanf, printf
cdef int t, i
cdef long long n, m, a, b
scanf('%d', &t)
for i in range(t):
    scanf('%lld%lld%lld%lld', &n, &m, &a, &b)
    printf('%lld\n', floor_sum(n, m, a, b))
"""
import os, sys

if sys.argv[-1] == "ONLINE_JUDGE":
    open("solve.pyx", "w").write(code)
    os.system("cythonize -i -3 -b solve.pyx")
import solve

code = r"""
# distutils: language=c++
# distutils: include_dirs=[/home/contestant/.local/lib/python3.8/site-packages/numpy/core/include, /opt/atcoder-stl]
# cython: boundscheck=False
# cython: wraparound=False
from libc.stdio cimport getchar, printf
cdef extern from "/opt/atcoder-stl/atcoder/math.hpp" namespace "atcoder":
    cdef long long floor_sum(long long n, long long m, long long a, long long b)
cdef long long cin() nogil:
    cdef long long b, c = 0
    while 1:
        b = getchar() - 48
        if b < 0: break
        c = c * 10 + b
    return c
cdef int i, t = cin()
cdef long long n, m, a, b
for i in range(t):
    n = cin()
    m = cin()
    a = cin()
    b = cin()
    printf('%lld\n', floor_sum(n, m, a, b))
"""
import os, sys

if sys.argv[-1] == "ONLINE_JUDGE":
    open("solve.pyx", "w").write(code)
    os.system("cythonize -i -3 -b solve.pyx")
import solve

+from libc.stdio cimport getchar, printf -from libc.stdio cimport scanf, printf -cdef int t, i +cdef long long cin() nogil: +    cdef long long b, c = 0 +    while 1: +        b = getchar() - 48 +        if b < 0: break +        c = c * 10 + b +    return c +cdef int i, t = cin() -scanf('%d', &t) -    scanf('%lld%lld%lld%lld', &n, &m, &a, &b) +    n = cin() +    m = cin() +    a = cin() +    b = cin()