from math import gcd

N = int(input())
AB = [map(int, input().split()) for _ in range(N)]

ab = set()
d = {}
d[0] = {}
d[0][0] = 0
for a, b in AB:
    i = gcd(a, b)
    if i != 0:
        a //= i
        b //= i
    if a < 0:
        a, b = -a, -b
    ab.add((a, b))
    d.setdefault(a, {})
    d[a].setdefault(b, 0)
    d[a][b] += 1
if (0, 0) in ab:
    ab.remove((0, 0))

result = 1
used = set()
for a, b in ab:
    if (a, b) in used:
        continue
    i = d[a][b]
    j = 0
    if -b in d and a in d[-b]:
        j = d[-b][a]
        used.add((-b, a))
    result *= pow(2, i, 1000000007) + pow(2, j, 1000000007) - 1
    result %= 1000000007
result += d[0][0] - 1
result %= 1000000007
print(result)