from functools import cmp_to_key



MOD = 10 ** 9 + 7





def func(a, b):

    if a[0] * b[1] == a[1] * b[0]:

        return 0

    elif a[0] * b[1] < a[1] * b[0]:

        return - 1

    else:

        return 1





n = int(eval(input()))

a = [0] * n

b = [0] * n

i = 0

f = 0

while i < n:

    a[i], b[i] = list(map(int, input().split()))

    if a[i] == 0 and b[i] == 0:

        f += 1

        n -= 1

        continue

    if a[i] < 0:

        a[i] = -a[i]

        b[i] = -b[i]

    if a[i] == 0 and b[i] < 0:

        b[i] = -b[i]

    i += 1

l = sorted(zip(a, b), key=cmp_to_key(func))

if l[0][1] > 0:

    li = [[1, 0, l[0][0], l[0][1]]]

else:

    li = []

for i in range(1, n):

    a, b = l[i - 1]

    c, d = l[i]

    if d <= 0:

        break

    if li and a * d == b * c:

        li[-1][0] += 1

    else:

        li.append([1, 0, c, d])

idx = 0

cnt = 0

for j in range(n):

    a, b = l[j]

    if b > 0:

        continue

    a, b = -b, a

    while idx < len(li) and li[idx][2] * b < li[idx][3] * a:

        idx += 1

    if idx < len(li) and li[idx][2] * b == li[idx][3] * a:

        li[idx][1] += 1

    else:

        cnt += 1

ans = 1

for a, b, c, d in li:

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

    ans %= MOD

print(((ans * (pow(2, cnt, MOD)) - 1 + f) % MOD))

from math import gcd

from collections import defaultdict



MOD = 10 ** 9 + 7



n = int(eval(input()))

d = defaultdict(int)

tmp = 0

for i in range(n):

    a, b = list(map(int, input().split()))

    if a == b == 0:

        tmp += 1

    else:

        if b < 0 or (b == 0 and a <= 0):

            a = -a

            b = -b

        g = gcd(a, b)

        a = a // g

        b = b // g

        d[(a, b)] += 1

        if a <= 0:

            d[(b, -a)]

        else:

            d[(-b, a)]

ans = 1

for k, v in list(d.items()):

    a, b = k

    if a <= 0:

        continue

    c = d[(-b, a)]

    ans *= pow(2, v) + pow(2, c) - 1

    ans %= MOD

print(((ans + tmp - 1) % MOD))

from functools import cmp_to_key

MOD = 10**9 + 7


def func(a, b):
    if a[0] * b[1] == a[1] * b[0]:
        return 0
    elif a[0] * b[1] < a[1] * b[0]:
        return -1
    else:
        return 1


n = int(eval(input()))
a = [0] * n
b = [0] * n
i = 0
f = 0
while i < n:
    a[i], b[i] = list(map(int, input().split()))
    if a[i] == 0 and b[i] == 0:
        f += 1
        n -= 1
        continue
    if a[i] < 0:
        a[i] = -a[i]
        b[i] = -b[i]
    if a[i] == 0 and b[i] < 0:
        b[i] = -b[i]
    i += 1
l = sorted(zip(a, b), key=cmp_to_key(func))
if l[0][1] > 0:
    li = [[1, 0, l[0][0], l[0][1]]]
else:
    li = []
for i in range(1, n):
    a, b = l[i - 1]
    c, d = l[i]
    if d <= 0:
        break
    if li and a * d == b * c:
        li[-1][0] += 1
    else:
        li.append([1, 0, c, d])
idx = 0
cnt = 0
for j in range(n):
    a, b = l[j]
    if b > 0:
        continue
    a, b = -b, a
    while idx < len(li) and li[idx][2] * b < li[idx][3] * a:
        idx += 1
    if idx < len(li) and li[idx][2] * b == li[idx][3] * a:
        li[idx][1] += 1
    else:
        cnt += 1
ans = 1
for a, b, c, d in li:
    ans *= pow(2, a, MOD) + pow(2, b, MOD) - 1
    ans %= MOD
print(((ans * (pow(2, cnt, MOD)) - 1 + f) % MOD))

from math import gcd
from collections import defaultdict

MOD = 10**9 + 7
n = int(eval(input()))
d = defaultdict(int)
tmp = 0
for i in range(n):
    a, b = list(map(int, input().split()))
    if a == b == 0:
        tmp += 1
    else:
        if b < 0 or (b == 0 and a <= 0):
            a = -a
            b = -b
        g = gcd(a, b)
        a = a // g
        b = b // g
        d[(a, b)] += 1
        if a <= 0:
            d[(b, -a)]
        else:
            d[(-b, a)]
ans = 1
for k, v in list(d.items()):
    a, b = k
    if a <= 0:
        continue
    c = d[(-b, a)]
    ans *= pow(2, v) + pow(2, c) - 1
    ans %= MOD
print(((ans + tmp - 1) % MOD))

-from functools import cmp_to_key +from math import gcd +from collections import defaultdict - - -def func(a, b): -    if a[0] * b[1] == a[1] * b[0]: -        return 0 -    elif a[0] * b[1] < a[1] * b[0]: -        return -1 +n = int(eval(input())) +d = defaultdict(int) +tmp = 0 +for i in range(n): +    a, b = list(map(int, input().split())) +    if a == b == 0: +        tmp += 1 -        return 1 - - -n = int(eval(input())) -a = [0] * n -b = [0] * n -i = 0 -f = 0 -while i < n: -    a[i], b[i] = list(map(int, input().split())) -    if a[i] == 0 and b[i] == 0: -        f += 1 -        n -= 1 +        if b < 0 or (b == 0 and a <= 0): +            a = -a +            b = -b +        g = gcd(a, b) +        a = a // g +        b = b // g +        d[(a, b)] += 1 +        if a <= 0: +            d[(b, -a)] +        else: +            d[(-b, a)] +ans = 1 +for k, v in list(d.items()): +    a, b = k +    if a <= 0: -    if a[i] < 0: -        a[i] = -a[i] -        b[i] = -b[i] -    if a[i] == 0 and b[i] < 0: -        b[i] = -b[i] -    i += 1 -l = sorted(zip(a, b), key=cmp_to_key(func)) -if l[0][1] > 0: -    li = [[1, 0, l[0][0], l[0][1]]] -else: -    li = [] -for i in range(1, n): -    a, b = l[i - 1] -    c, d = l[i] -    if d <= 0: -        break -    if li and a * d == b * c: -        li[-1][0] += 1 -    else: -        li.append([1, 0, c, d]) -idx = 0 -cnt = 0 -for j in range(n): -    a, b = l[j] -    if b > 0: -        continue -    a, b = -b, a -    while idx < len(li) and li[idx][2] * b < li[idx][3] * a: -        idx += 1 -    if idx < len(li) and li[idx][2] * b == li[idx][3] * a: -        li[idx][1] += 1 -    else: -        cnt += 1 -ans = 1 -for a, b, c, d in li: -    ans *= pow(2, a, MOD) + pow(2, b, MOD) - 1 +    c = d[(-b, a)] +    ans *= pow(2, v) + pow(2, c) - 1 -print(((ans * (pow(2, cnt, MOD)) - 1 + f) % MOD)) +print(((ans + tmp - 1) % MOD))