from math import gcd
mod = 1000000007
n = int(input())
zero = 0
bad = {}
for i in range(n):
    a,b = map(int, input().split())

    if a == 0 and b == 0:
        zero += 1
        continue

    if a != 0 or b != 0:
        g = gcd(a, b)
        a //= g
        b //= g

    is_minus = True
    if a>0 and b>0 : is_minus = False
    if a<0 and b<0 : is_minus = False
    sign_ab = -1 if is_minus else 1
    sign_cd = 1 if is_minus else -1
    d, c = a, b = abs(a), abs(b)
    key1 = (sign_ab*a, b)
    key2 = (sign_cd*c, d)

    if key1 in bad: bad[key1][0] += 1
    elif key2 in bad: bad[key2][1] += 1
    else: bad[key1] = [1,0]

cnt = 1
for a,b in bad:
    c1, c2 = bad[a, b]
    c3 = 0
    c3 += pow(2, c1, mod) - 1
    c3 += pow(2, c2, mod) - 1
    c3 += 1
    cnt = cnt * c3 % mod

ans = (cnt + zero - 1) % mod

# print('cnt',cnt)
# print('zero',zero)
# print('ans',ans)
print((ans+mod) % mod)
