def main():
    import math
    import collections
    N = int(input())

    # def cmb(n, r, mod):
    #     if (r < 0 or r > n):
    #         return 0
    #     r = min(r, n-r)
    #     return g1[n] * g2[r] * g2[n-r] % mod

    mod = 10**9+7
    # g1 = [1, 1]  # 元テーブル
    # g2 = [1, 1]  # 逆元テーブル
    # inverse = [0, 1]  # 逆元テーブル計算用テーブル

    # for i in range(2, N + 1):
    #     g1.append((g1[-1] * i) % mod)
    #     inverse.append((-inverse[mod % i] * (mod//i)) % mod)
    #     g2.append((g2[-1] * inverse[-1]) % mod)

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

    # d = collections.defaultdict(int)
    d = collections.defaultdict(set)
    # d2 = collections.defaultdict(int)
    i = 0
    ab = []
    for a, b in AB:
        g = math.gcd(a, b)
        a = a // g
        b = b // g
        # d[(a, b)] += 1
        if a > 0 and b < 0:
            a = -a
            b = -b
        d[(a, b)].add(i)
        ab.append((a, b))
        i += 1

    ans = 0
    r = set()

    dd = [1]
    for i in range(1, N):
        dd.append(dd[i-1]*2 % mod)

    r = set()
    ans = 1
    for (a, b) in d:
        if (a, b) in r:
            continue
        l1 = len(d[(a, b)])
        tmp = dd[l1]
        s = set()
        if (-b, a) in d:
            s |= d[(-b, a)]
        if (b, -a) in d:
            s |= d[(b, -a)]
        l2 = len(s)
        if l2:
            ans *= tmp + dd[l2] - 1
            N -= l1 + l2
            ans %= mod

            r.add((-b, a))
            r.add((b, -a))
        else:
            continue

    ans *= dd[N]
    ans -= 1

    print(ans % mod)


main()
