from math import gcd
from collections import defaultdict

def sign(a):
    if a == 0:
        return 0
    else:
        return a//abs(a)

n = int(input())
a, b = [], []
for i in range(n):
    data = list(map(int, input().split()))
    a.append(data[0])
    b.append(data[1])

d = defaultdict(lambda: [0, 0])
zeros = 0

for i in range(n):
    g = gcd(a[i], b[i])
    a[i] //= g
    b[i] //= g
    if a[i]*b[i] > 0:
        d[(abs(a[i]), abs(b[i]))][0] += 1
    elif a[i]*b[i] < 0:
        d[(abs(b[i]), abs(a[i]))][1] += 1
    elif a[i] == 0 and b[i] != 0:
        d[(0, 1)][0] += 1
    elif b[i] == 0 and a[i] != 0:
        d[(0, 1)][1] += 1
    elif a[i] == b[i] == 0:
        zeros += 1

mod = 1000000007
cnt = 1
for pair in d.values():
    cnt *= pow(2, pair[0], mod) + pow(2, pair[1], mod) - 1
    cnt %= mod
cnt += zeros - 1
print(cnt)