from math import gcd

n = int(eval(input()))

P = [tuple(map(int, input().split())) for i in range(n)]

C = {}

for x, y in P:

    if x == 0 and y == 0:

        x0, y0 = 0, 0

    elif x != 0 and y == 0:

        x0, y0 = 1, 0

    elif x == 0 and y != 0:

        x0, y0 = 0, 1

    else:

        g = gcd(x, y)

        x0, y0 = x // g, y // g

    if y0 < 0:

        x0, y0 = -x0, -y0

    try:

        C[(x0, y0)] += 1

    except KeyError:

        C[(x0, y0)] = 1

D = []

for x, y in list(C.keys()):

    if x <= 0:

        try:

            C[(y, -x)]

        except KeyError:

            D.append((y, -x))

for x, y in D:

    C[(x, y)] = 0

ans = 1

p = 10**9 + 7

for x, y in list(C.keys()):

    if x > 0:

        a = C[(x, y)]

        try:

            b = C[(-y, x)]

        except KeyError:

            b = 0

        ans *= pow(2, a, p) + pow(2, b, p) - 1

        ans %= p

try:

    ans += C[(0, 0)] - 1

except KeyError:

    ans -= 1

print((ans % p))

from math import gcd

n = int(eval(input()))

XY = [tuple(map(int, input().split())) for i in range(n)]

C = {}

z = 0

for x, y in XY:

    if x == 0 and y == 0:

        z += 1

        continue

    g = gcd(x, y)

    x, y = x // g, y // g

    if y < 0:

        x, y = -x, -y

    try:

        C[(x, y)] += 1

    except KeyError:

        C[(x, y)] = 1

ans = 1

p = 10**9 + 7

for x, y in C:

    if C[(x, y)] == 0:

        continue

    a = C[(x, y)]

    if x > 0:

        x0, y0 = -y, x

    else:

        x0, y0 = y, -x

    try:

        b = C[(x0, y0)]

        C[(x0, y0)] = 0

    except KeyError:

        b = 0

    ans *= pow(2, a, p) + pow(2, b, p) - 1

    ans %= p

    C[(x, y)] = 0

print(((ans + z - 1) % p))

from math import gcd

n = int(eval(input()))
P = [tuple(map(int, input().split())) for i in range(n)]
C = {}
for x, y in P:
    if x == 0 and y == 0:
        x0, y0 = 0, 0
    elif x != 0 and y == 0:
        x0, y0 = 1, 0
    elif x == 0 and y != 0:
        x0, y0 = 0, 1
    else:
        g = gcd(x, y)
        x0, y0 = x // g, y // g
    if y0 < 0:
        x0, y0 = -x0, -y0
    try:
        C[(x0, y0)] += 1
    except KeyError:
        C[(x0, y0)] = 1
D = []
for x, y in list(C.keys()):
    if x <= 0:
        try:
            C[(y, -x)]
        except KeyError:
            D.append((y, -x))
for x, y in D:
    C[(x, y)] = 0
ans = 1
p = 10**9 + 7
for x, y in list(C.keys()):
    if x > 0:
        a = C[(x, y)]
        try:
            b = C[(-y, x)]
        except KeyError:
            b = 0
        ans *= pow(2, a, p) + pow(2, b, p) - 1
        ans %= p
try:
    ans += C[(0, 0)] - 1
except KeyError:
    ans -= 1
print((ans % p))

from math import gcd

n = int(eval(input()))
XY = [tuple(map(int, input().split())) for i in range(n)]
C = {}
z = 0
for x, y in XY:
    if x == 0 and y == 0:
        z += 1
        continue
    g = gcd(x, y)
    x, y = x // g, y // g
    if y < 0:
        x, y = -x, -y
    try:
        C[(x, y)] += 1
    except KeyError:
        C[(x, y)] = 1
ans = 1
p = 10**9 + 7
for x, y in C:
    if C[(x, y)] == 0:
        continue
    a = C[(x, y)]
    if x > 0:
        x0, y0 = -y, x
    else:
        x0, y0 = y, -x
    try:
        b = C[(x0, y0)]
        C[(x0, y0)] = 0
    except KeyError:
        b = 0
    ans *= pow(2, a, p) + pow(2, b, p) - 1
    ans %= p
    C[(x, y)] = 0
print(((ans + z - 1) % p))

-P = [tuple(map(int, input().split())) for i in range(n)] +XY = [tuple(map(int, input().split())) for i in range(n)] -for x, y in P: +z = 0 +for x, y in XY: -        x0, y0 = 0, 0 -    elif x != 0 and y == 0: -        x0, y0 = 1, 0 -    elif x == 0 and y != 0: -        x0, y0 = 0, 1 -    else: -        g = gcd(x, y) -        x0, y0 = x // g, y // g -    if y0 < 0: -        x0, y0 = -x0, -y0 +        z += 1 +        continue +    g = gcd(x, y) +    x, y = x // g, y // g +    if y < 0: +        x, y = -x, -y -        C[(x0, y0)] += 1 +        C[(x, y)] += 1 -        C[(x0, y0)] = 1 -D = [] -for x, y in list(C.keys()): -    if x <= 0: -        try: -            C[(y, -x)] -        except KeyError: -            D.append((y, -x)) -for x, y in D: -    C[(x, y)] = 0 +        C[(x, y)] = 1 -for x, y in list(C.keys()): +for x, y in C: +    if C[(x, y)] == 0: +        continue +    a = C[(x, y)] -        a = C[(x, y)] -        try: -            b = C[(-y, x)] -        except KeyError: -            b = 0 -        ans *= pow(2, a, p) + pow(2, b, p) - 1 -        ans %= p -try: -    ans += C[(0, 0)] - 1 -except KeyError: -    ans -= 1 -print((ans % p)) +        x0, y0 = -y, x +    else: +        x0, y0 = y, -x +    try: +        b = C[(x0, y0)] +        C[(x0, y0)] = 0 +    except KeyError: +        b = 0 +    ans *= pow(2, a, p) + pow(2, b, p) - 1 +    ans %= p +    C[(x, y)] = 0 +print(((ans + z - 1) % p))