import re
from math import prod
data = [tuple(map(int,re.findall(r"-?\d+",line))) for line in open(0).read().splitlines()]
p1 = 0
def get_quadrant(location):
    x,y = location
    if x == 50 or y == 51:
        return 0
    return (x<50)*2+(y<51)+1
end_locs = [((px+vx*100)%101, (py+vy*100)%103) for px, py, vx, vy in data]
quads = [0]*5
for loc in end_locs:
    quads[get_quadrant(loc)] += 1
print(prod(quads[1:]))

