from math import gcd
from collections import defaultdict

N = int(input())
d = {}
MOD = 10**9+7

for _ in range(N):
    A, B = map(int, input().split())
    g = gcd(A, B)
    A//=g
    B//=g
    if (A, B) in d:
        d[(A, B)] += 1
    else:
        d[(A, B)] = 1

b = 1
used = defaultdict(int)

for (i, j), v in d.items():
    if used[(i, j)]:continue
    buf = 0
    if (-j, i) in d or (j, -i) in d:
        if (-j, i) in d:
            used[(-j, i)] = 1
            buf += pow(2, d[(-j, i)], MOD)+pow(2, v, MOD)-1
        if (j, -i) in d:
            used[(j, -i)] = 1
            buf += pow(2, d[(j, -i)], MOD)+pow(2, v, MOD)-1
        b *= buf
    else:
        b *= pow(2, v, MOD)
    b %= MOD
b -= 1
b %= MOD
print(b)