import math
N = int(input())
zero = 0
mp = {}
for i in range(N):
    x, y = map(int, input().split())
    if (x == 0 and y == 0):
        zero += i
        continue
    g = math.gcd(x, y)
    x, y = x//g, y//g
    if y < 0:
        x = -x
        y = -y

    if y == 0 and x < 0:
        x = -x
        y = -y

    rot90 = True if x <= 0 else False
    if rot90:
        tmp = x
        x, y = y, -tmp
    if (x, y) not in mp.keys():
        mp[(x, y)] = [0, 0]

    if rot90:
        mp[(x, y)][0] += 1
    else:
        mp[(x, y)][1] += 1

mod = 1000000007

ans = 1
for p in mp.values():
    s = p[0]
    t = p[1]
    now = 1
    now += pow(2, s, mod) - 1
    now += pow(2, t, mod) - 1
    ans *= now
    ans %= mod

ans -= 1
ans += zero
print(ans%mod)
