from collections import defaultdict as dd

def ri():
    return int(input())

def rl():
    return map(int, input().split())

def rl2():
    return list(rl())

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

N = ri()
pairs = {'i': [0,0]}
for i in range(N):
    a, b = rl()
    if a == 0 and b == 0:
        continue
    elif a == 0:
        pairs['i'][0] += 1
    elif b == 0:
        pairs['i'][1] += 1
    else:
        g = gcd(abs(a), abs(b))
        a //= g
        b //= g
        if b >= 0 and a >= 0:
            slope = (a, b)
            opp   = (-b, a)
        elif b >= 0 and a < 0:
            slope = (a, b)
            opp   = (b, -a)
        elif b < 0 and a >= 0:
            slope = (-a, -b)
            opp   = (-b, a)
        else:
            slope = (-a, -b)
            opp   = (b, -a)

        if slope in pairs:
            pairs[slope][0] += 1
        elif opp in pairs:
            pairs[opp][1] += 1
        else:
            pairs[slope] = [1, 0]

tot = 1
mod = 10**9 + 7
for slope, pair in pairs.items():
    # print (slope, pair)
    tot *= (pow(2, pair[0], mod) + pow(2, pair[1], mod) - 1)
    tot %= mod
print (tot - 1)

