MOD = 1000000007
N = int(input())

E = [list(map(int, input().split())) for i in range(N)]

T1 = []
T2 = []
T0 = 0

def gcd(x, y):
    while y:
        x, y = y, x % y
    return x

for i in range(N): #第一象限、第二象限だけを考える
    if E[i][0] <= 0 and E[i][1] <= 0:
        E[i][0] = -E[i][0]
        E[i][1] = -E[i][1]
    elif E[i][0] >= 0 and E[i][1] < 0:
        E[i][0] = -E[i][0]
        E[i][1] = -E[i][1]

for i in range(N):
    if E[i][0] == E[i][1] == 0:
        T0 += 1
    elif E[i][0] > 0:
        g = gcd(E[i][0], E[i][1])
        T1.append([E[i][0]//g, E[i][1]//g])
    else:
        g = gcd(E[i][0], E[i][1])
        T2.append([E[i][1]//g, -(E[i][0]//g)])

from collections import defaultdict

D = defaultdict(lambda :[0, 0])

for i in range(len(T1)):
    D[(T1[i][0], T1[i][1])][0] += 1

for i in range(len(T2)):
    D[(T2[i][0], T2[i][1])][1] += 1

res = 1

for x, y in D.values():

    if x > 0 and y > 0:
        res *= (1 + pow(2, x, MOD) - 1 + pow(2, y, MOD) - 1)
        res %= MOD
    elif x > 0:
        res *= pow(2, x, MOD)
        res %= MOD
    elif y > 0:
        res *= pow(2, y, MOD)
        res %= MOD

print(res - 1 + T0)