import math
N = int(input())
mod = 10 ** 9 + 7
zero = 0
d = {}
for i in range(N):
    x, y = map(int, input().split())
    if x == 0 and y == 0:
        zero += 1
        continue
    g = math.gcd(x, y)
    x /= g
    y /= g
    if y < 0:
        x = - x
        y = - y
    if y == 0 and x < 0:
        x = - x
        y = - y
    rot90 = x <= 0
    if rot90:
        tmp = x
        x = y
        y = - tmp
    if rot90:
        if (x, y) not in d:
            d[(x, y)] = [0, 0]
        d[(x, y)][0] += 1
    else:
        if (x, y) not in d:
            d[(x, y)] = [0, 0]
        d[(x, y)][1] += 1
ans = 1
for p in d.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)
