import math
n = int(input())
from collections import defaultdict
d = defaultdict(list)
s = set()
for i in range(n):
    a,b = map(int, input().split())
    g = math.gcd(a,b)
    a //= g; b //= g
    if a<0:
        a,b = -a, -b
    d[a,b].append(i)
v = 1
s = set()
M = 10**9+7
for (a,b),val in d.items():
    aa,bb = b,-a
    if aa<0:
        aa,bb = -aa, -bb
    if (a,b) in s or (aa,bb) in s:
        continue
    if (aa,bb) in d.keys():
        v *= (pow(2, len(val), M) + pow(2, len(d[aa,bb]), M) - 1)
    else:
        v *= pow(2, len(val), M)
    v %= M
    s.add((a,b))
    s.add((aa,bb))
v -= 1
print(v%M)